White scenery @showyou, hatena

If you have any comments, you may also send twitter @shsub or @showyou.

pythonで文字を数値として扱う

昨日のbonlifeさんのコメント、およびhttp://blog.livedoor.jp/dankogai/archives/50696206.htmlを参考にした結果、次の様な形で動くことがわかりました。

>>> print [u'あいうえお']
[u'\u3042\u3044\u3046\u3048\u304a']
>>> for i in u'あいうえお':
...   hex(ord(i))
...
'0x3042'
'0x3044'
'0x3046'
'0x3048'
'0x304a'
>>> print unichr(0x3042)

>>>