티스토리 뷰

Python idle에러로 


idle에서 4bytes 유니코드를 제대로 출력못하는 경우에 발생합니다.


1
2
str = '\U0001F44D'
print(str)
cs


idle에서 실행하면 아래와 같이 실패합니다.

>>> str = '\U0001F44D';
>>> str
'\U0001f44d'
>>> print(str)
Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    print(str)
  File "C:\Python34\lib\idlelib\PyShell.py", line 1347, in write
    return self.shell.write(s, self.tags)
UnicodeEncodeError: 'UCS-2' codec can't encode character '\U0001f44d' in position 0: Non-BMP character not supported in Tk



pycharm이나 utf8 지원하는 콘솔에서 실행하면 잘 됩니다. 

댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함