The Python Oracle

What does the 'b' character do in front of a string literal?

Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn

--

Track title: CC O Beethoven - Piano Sonata No 3 in C

--

Chapters
00:00 Question
01:14 Accepted answer (Score 536)
02:04 Answer 2 (Score 1094)
05:37 Answer 3 (Score 39)
06:23 Answer 4 (Score 30)
06:55 Thank you

--

Full question
https://stackoverflow.com/questions/6269...

Question links:
[related question]: https://stackoverflow.com/q/4749442/3465...
[this documentation]: http://docs.python.org/tutorial/introduc...

Accepted answer links:
[the Python 2.x documentation]: https://docs.python.org/2/reference/lexi...
[Python 3 documentation]: https://docs.python.org/3/reference/lexi...

Answer 2 links:
[Python 3.x]: http://www.diveintopython3.net/strings.h...
[depending on the widest character in the string]: https://www.python.org/dev/peps/pep-0393/
[encode]: http://en.wikipedia.org/wiki/Character_e...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#python #string #unicode #binary

#avk47