Python Unicode Encoding
问题 I am using argparse to read in arguments for my python code. One of those inputs is a title of a file [ title ] which can contain Unicode characters. I have been using 22少女時代22 as a test string. I need to write the value of the input title to a file, but when I try to convert the string to UTF-8 it always throws an error: UnicodeDecodeError: 'ascii' codec can't decode byte 0x8f in position 2: ordinal not in range(128) I have been looking around and see I need my string to be in the form u"foo