挑战Python100题(7)

100+ Python challenging programming exercises 7

Question 61

Print a unicode string “hello world”.

Hints: Use u’strings’ format to define unicode string.

打印一个unicode字符串“helloworld”。
提示:使用u“字符串”格式定义unicode字符串。

Solution:

unicodeString = u"hello world!"
print(unicodeString)

Question 62

Write a program to read an ASCII string and to convert it to a unicode string encoded by utf-8.

Hints: Use unicode() function to convert.

编写一个程序来读取ASCII字符串,并将其转换为utf-8编码的unicode字符串。

提示:使用unicode()函数进行转换。

Solution:

s = input()
u = unicode( s ,"utf-8")
print(u)

Question 63

版权声明:本文为博主作者:Hann Yang原创文章,版权归属原作者,如果侵权,请联系我们删除!

原文链接:https://blog.csdn.net/boysoft2002/article/details/135240434

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
xiaoxingxing的头像xiaoxingxing管理团队
上一篇 2024年1月6日
下一篇 2024年1月6日

相关推荐