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)