![]() ![]() It applies string_escape or unicode_escape encoding when necessary, which quote characters using Python's string escape. Instead safe_unicode() and safe_str() can apply to either unicode or byte string. Any mistake might end up in UnicodeError. call encode() for unicode string, decode() for byte string). You also have to pay attention to the direction (i.e. Unicode_text = byte_code(encoding)īyte_string = unicode_string.encode(encoding) The proper way to convert them is to use the encode and decode method, e.g. ![]() ASCII, strict), which more often then not would result in UnicodeError. In such case Python would just apply the system encoding (e.g. However they cannot be applied to text string or unicode string in general. Python's built in function str() and unicode() return a string representation of the object in byte string and unicode string respectively. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |