2013-05-18から1日間の記事一覧
Pythonで日本語を利用しているとき、unicode文字列をstr関数に渡すとUnicodeEncodeErrorが起きます。 例えば以下のコードを実行すると次のようなエラーが出てきます。 コード #!/usr/bin/python # -*- coding: utf-8 -*- test = u"テスト" print str(test) …
Pythonで日本語を利用しているとき、unicode文字列をstr関数に渡すとUnicodeEncodeErrorが起きます。 例えば以下のコードを実行すると次のようなエラーが出てきます。 コード #!/usr/bin/python # -*- coding: utf-8 -*- test = u"テスト" print str(test) …