-
-
Save jerzyk/f6f75275156eb48bfa22fe42470380ab to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In [1] text = u'zażółć gęślą jaźń' | |
In [2] open('test.txt', 'w').write(text) | |
--------------------------------------------------------------------------- | |
UnicodeEncodeError Traceback (most recent call last) | |
<ipython-input-2-da71a133970f> in <module>() | |
----> 1 open('test.txt', 'w').write(text) | |
UnicodeEncodeError: 'ascii' codec can't encode characters in position 2-5: ordinal not in range(128) | |
In [3] open('test.txt', 'w').write(text.encode('utf-8')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment