close

B in Front of String in Python

Hello guys. How are you all? I hope you all fine. In this tutorial we will learn about B in Front of String in Python. so without wasting time lets learn about of this.

B in Front of String in Python

  1. How to Use B in Front of String in Python

    To put B in Front of String in Python just Use encode() .By using encode() you can print B in front of string. Lets learn about of this by given below example: str = 'Hello guys.How are you?' print(str.encode()) Output : b'Hello guys.How are you?'

  2. B in Front of String in Python

    To put B in Front of String in Python just Use b” statement .By using b” statement you can print B in front of string. Lets learn about of this by given below example: str = b'Hello guys.How are you?' print(str) Output : b'Hello guys.How are you?'

  3. b python

    To put B in Front of String in Python just Use b” statement .By using b” statement you can print B in front of string. Lets learn about of this by given below example: str = b'Hello guys.How are you?' print(str) Output : b'Hello guys.How are you?'

Method 1: Use encode()

By using encode() you can print B in front of string. Lets learn about of this by given below example:

str = 'Hello guys.How are you?'
print(str.encode())

Output :

b'Hello guys.How are you?'

Method 2: Use b” statement

By using b” statement you can print B in front of string. Lets learn about of this by given below example:

str = b'Hello guys.How are you?'
print(str)

Output :

b'Hello guys.How are you?'

Conclusion

It’s all About this Tutorial. Hope all methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which method worked for you?

Also, Read

Leave a Comment