在Python 2.7中打印版权图标

2024-05-14 15:59:11 发布

您现在位置:Python中文网/ 问答频道 /正文

为什么行号11的print语句的输出没有显示版权图标?我需要做什么代码更改才能在输出中打印图标?代码中还有其他显示图标的打印语句

 # -*- coding: utf-8 -*-
from datetime import datetime
cy = datetime.now().year
print(cy)
s2 = "©2019 Gogo. All rights reserved"
print (s2)
EXP_RES = ['testservice@testhis.com',
           '1-303-666-3278',
           (u"©") + str(cy) + ' ' + "Tester. All rights reserved."]
print(EXP_RES)
print [x.encode('UTF8') for x in EXP_RES]
s1 = ("©")
print(s1)

实际结果:

©2019 Gogo. All rights reserved
['testservice@testhis.com', '1-303-666-3278', u'\xa92019 Tester. All rights reserved.']
['testservice@testhis.com', '1-303-666-3278', '\xc2\xa92019 Tester. All rights reserved.']
©

Expected Results:
©2019 Gogo. All rights reserved
['testservice@testhis.com', '1-303-666-3278', u'\xa92019 Tester. All rights reserved.']
['testservice@testhis.com', '1-303-666-3278', '©2019 Tester. All rights reserved.']
©

Tags: testcomdatetimeserviceresall图标tester

热门问题