Python What Does ‘u', 'r', 'b' Mean in Front of a String
1. ‘u’ means Unicode
The ‘u’ in front of a string means the string is a Unicode string.
1 |
|
In Python 2.x, a Unicode string is marked with ‘u’.
However, in Python 3 all strings are Unicode strings by default. Thus you will never see ‘u’ in front of a Unicode string in Python 3.
2. ‘r’ means raw strings
1 |
|
3. ‘b’ means bytes
The b”” notation is used to specify a bytes
string in Python.
1 |
|
Python What Does ‘u', 'r', 'b' Mean in Front of a String
https://www.hardyhu.cn/2022/02/25/Python-What-Does-‘u-r-b-Mean-in-Front-of-a-String/