R. David Murray added the comment: re: file. You forgot the 'u' in front of the string:
>>> f.write(u'This is a «test»\n') Traceback (most recent call last): File "<stdin>", line 1, in <module> UnicodeEncodeError: 'ascii' codec can't encode character u'\xab' in position 10: ordinal not in range(128) So you were actually writing binary in your console encoding, which must have been utf-8. (This kind of confusion is the main reason python3 exists). ---------- title: Confusing statement -> Confusing statement about unicode strings in tutorial introduction _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue20686> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com