重複の可能性:
Python正規表現のUnicode文字の一致
使用する
re.findall(r'\w+', ip)
Fältskog
返品時F
およびltskog
。文字列とUnicodeの両方で試しましたが、同じです。結果
重複の可能性:
Python正規表現のUnicode文字の一致
使用する
re.findall(r'\w+', ip)
Fältskog
返品時F
およびltskog
。文字列とUnicodeの両方で試しましたが、同じです。結果
適切な フラグを設定する必要があります(この場合、意味UNICODE
を伝えるため):re
\w
re.findall(r'\w+', ip, re.UNICODE)
# EDIT
Python 2.7.3 (default, Aug 1 2012, 05:16:07)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> re.findall(r"\w+", u"Fältskog", re.UNICODE)
[u'F\xe4ltskog']
>>>
re.findall(r'[åäöÅÄÖ\w] +'、ip)
より視覚的にしたい場合は、これを行うこともできます。