1,r/R表示raw string(原始字符串)
#!/usr/bin/python str1 = 'hello \n world' str2 = r'hello \n world' print(str1) print(str2)
2,u/U表示unicode string(unicode編碼字符串)
#!/usr/bin/python str1 = '\u4f60\u597d\u4e16\u754c' str2 = u'\u4f60\u597d\u4e16\u754c' print(str1) print(str2)
3,b/B表示byte string(轉換成bytes類型)
#!/usr/bin/python str1 = 'hello world' str2 = b'hello world' print(type(str1)) print(type(str2))