リンク
ちゃんと調べるときは
http://www.python.jp/doc/release/
Wiki内検索
最近更新したページ
最新コメント
文字コードの判定 by awesome things!
正規表現 by awesome things!
辞書 by stunning seo guys
文字列の16進変換 by check it out
文字コードの変換 by check this out
デバッガ by check this out
サブプロセス by watch for this
文字コードの判定 by watch for this
サニタイジング by check this out
タグ

文字列の16進変換

文字列を16進にする


デフォルトの文字コードがEUC-JPの場合


>>> print "−".encode("hex_codec")
a1dd

UTF-8での16進表示にする


>>> print "−".encode("UTF-8").encode("hex_codec")
e28892

16進表記から文字列にする。


デフォルトの文字コードがEUC-JPの場合


>>> print "a1dd".decode("hex_codec")
−

UTF-8の16進表記を戻す。


>>> print unicode("e28892".decode("hex_codec"), "UTF-8")
−
2009年11月18日(水) 11:16:56 Modified by hebi_




スマートフォン版で見る