Python100問にチャレンジ(7)

100 以上の Python の難しいプログラミング演習 7

質問61

Unicode 文字列「hello world」を出力します。

ヒント: Unicode 文字列を定義するには、u'strings' 形式を使用します。

Unicode 文字列「helloworld」を出力します。
ヒント: Unicode 文字列を定義するには、「文字列」形式を使用します。

解決:

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

質問62

ASCII 文字列を読み取り、utf-8 でエンコードされた Unicode 文字列に変換するプログラムを作成します。

ヒント: 変換には unicode() 関数を使用します。

ASCII 文字列を読み取り、utf-8 でエンコードされた Unicode 文字列に変換するプログラムを作成します。

ヒント: 変換には unicode() 関数を使用します。

解決:

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

質問63

おすすめ

転載: blog.csdn.net/boysoft2002/article/details/135240434