how to write unicode to a txt file?

Frank Potter at
Wed Jan 17 17:28:14 CET 2007

I want to change an srt file to unicode format so mpalyer can display
Chinese subtitles properly.
I did it like this:


But it seems that python can't directly write unicode to a file,
I got and error at the 3rd line:
UnicodeEncodeError: 'ascii' codec can't encode characters in position
85-96: ordinal not in range(128)

How to save the unicode string to the file, please?

More information about the Python-list mailing list