今日のひとこと Challange IT For Future

Pythonでunicode正規化

Python 読了 1分

この記事は最終更新から 11 年以上たっています。内容が現在の状況と異なる可能性があります。現在の情報は最新の記事、Fess の記事をご覧ください。

unicodedataを使えばよい。

$ python
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import unicodedata
>>> print unicodedata.normalize(u'NFKC', u'テスト①%@')
テスト1%@