Printing a font icon with os.write

风流意气都作罢 提交于 2020-06-23 14:07:37

问题


With Python 3.8.3 on Windows 10, my terminal, Set with a nerdfont that has icons, shows the thumbs up icon for:

import os, sys     # For the following attempts

print('\uf164')

I also get a thumbs up via:

sys.stdout.write('\uf164')

However, for:

os.write(1, '\uf164'.encode('utf8'))

I get 3 characters, one for each encoded byte.

How do I print the thumbs up using os.write?

来源:https://stackoverflow.com/questions/62502211/printing-a-font-icon-with-os-write

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!