Ask coding questions

← Back to all posts
Why this doesn't give this an error
BearCoder01

When i type print(b'hello') it doesn't give an error, Why?

Answered by IMayBeMe [earned 5 cycles]
View Answer
Voters
BearCoder01
Comments
hotnewtop
IMayBeMe

This is called a B string. Regular strings are a sequence of Unicode characters while a B string is a sequence of octets. It is normally used to represent a set of bytes but in your case I believe it is just ignored by the interpreter.

BearCoder01

@IMayBeMe thanks!