• <tfoot id='6jWyK'></tfoot>

    1. <legend id='6jWyK'><style id='6jWyK'><dir id='6jWyK'><q id='6jWyK'></q></dir></style></legend>
      • <bdo id='6jWyK'></bdo><ul id='6jWyK'></ul>

      <small id='6jWyK'></small><noframes id='6jWyK'>

      <i id='6jWyK'><tr id='6jWyK'><dt id='6jWyK'><q id='6jWyK'><span id='6jWyK'><b id='6jWyK'><form id='6jWyK'><ins id='6jWyK'></ins><ul id='6jWyK'></ul><sub id='6jWyK'></sub></form><legend id='6jWyK'></legend><bdo id='6jWyK'><pre id='6jWyK'><center id='6jWyK'></center></pre></bdo></b><th id='6jWyK'></th></span></q></dt></tr></i><div id='6jWyK'><tfoot id='6jWyK'></tfoot><dl id='6jWyK'><fieldset id='6jWyK'></fieldset></dl></div>

        在 Python 的控制台中显示 Emoji

        时间:2023-08-06
          <bdo id='VFhHK'></bdo><ul id='VFhHK'></ul>

          1. <legend id='VFhHK'><style id='VFhHK'><dir id='VFhHK'><q id='VFhHK'></q></dir></style></legend>

            <tfoot id='VFhHK'></tfoot>
            <i id='VFhHK'><tr id='VFhHK'><dt id='VFhHK'><q id='VFhHK'><span id='VFhHK'><b id='VFhHK'><form id='VFhHK'><ins id='VFhHK'></ins><ul id='VFhHK'></ul><sub id='VFhHK'></sub></form><legend id='VFhHK'></legend><bdo id='VFhHK'><pre id='VFhHK'><center id='VFhHK'></center></pre></bdo></b><th id='VFhHK'></th></span></q></dt></tr></i><div id='VFhHK'><tfoot id='VFhHK'></tfoot><dl id='VFhHK'><fieldset id='VFhHK'></fieldset></dl></div>

            <small id='VFhHK'></small><noframes id='VFhHK'>

                  <tbody id='VFhHK'></tbody>
                  本文介绍了在 Python 的控制台中显示 Emoji的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我想知道是否可以在 Windows 上的 Python 3 控制台中打印表情符号.实际上,为了避免以下错误:

                  I wonder if it's possible to print Emojis in a Python 3 console on Windows. Actually, to avoid the following error:

                  codec can't encode character 'U0001f44d' in position 10: character maps to  
                  <undefined>
                  

                  我用过:

                  import emoji as moji
                  print(moji.emojize('Python is :thumbsup:', use_aliases=True).encode('unicode-
                  escape'))
                  

                  也就是说,如预期的那样,打印正确的character:U0001f44d,没有任何exception.

                  which is, as expected, printing the right character:U0001f44d without any exception.

                  推荐答案

                  Windows 命令提示符对于 Unicode 字符有很多限制,尤其是那些基本多语言平面之外的字符(BMP,或 U+0000 到 U+FFFF).命令提示符默认为旧版 OEM 编码(美国 Windows 上为 cp437),并且对本地化编码之外的字符的字体支持有限.寻找一个对 UTF-8 有良好支持的 Python IDE.

                  The Windows command prompt has a lot of limitations with regards to Unicode characters, especially those outside the basic multilingual plane(BMP, or U+0000 to U+FFFF). The command prompt defaults to a legacy OEM encoding (cp437 on US Windows) and has limited font support for characters outside the localized encoding. Find a Python IDE that has good support for UTF-8.

                  查看各种 Unicode 字符的一种快速而简单的方法是写入文件并利用浏览器:

                  One quick-and-dirty way to see a wide variety of Unicode characters is to write to a file and leverage the browser:

                  import os
                  with open('test.htm','w',encoding='utf-8-sig') as f:
                      f.write('U0001f44d')
                  os.startfile('test.htm')
                  

                  这显示 在我的 Windows 10 系统上的最新 Chrome 浏览器中.

                  This displays in the latest Chrome browser on my Windows 10 system.

                  这篇关于在 Python 的控制台中显示 Emoji的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:如何在ctypes中传回指针? 下一篇:通过 connect 传递额外的参数

                  相关文章

                  最新文章

                • <small id='BkMte'></small><noframes id='BkMte'>

                    <i id='BkMte'><tr id='BkMte'><dt id='BkMte'><q id='BkMte'><span id='BkMte'><b id='BkMte'><form id='BkMte'><ins id='BkMte'></ins><ul id='BkMte'></ul><sub id='BkMte'></sub></form><legend id='BkMte'></legend><bdo id='BkMte'><pre id='BkMte'><center id='BkMte'></center></pre></bdo></b><th id='BkMte'></th></span></q></dt></tr></i><div id='BkMte'><tfoot id='BkMte'></tfoot><dl id='BkMte'><fieldset id='BkMte'></fieldset></dl></div>

                    • <bdo id='BkMte'></bdo><ul id='BkMte'></ul>
                    <legend id='BkMte'><style id='BkMte'><dir id='BkMte'><q id='BkMte'></q></dir></style></legend>
                  1. <tfoot id='BkMte'></tfoot>