4 ms·
I wish this was updated. I thought I'd check some things in python, and slide 37 about Python not treating characters as smallest units does not apply anymore.
by Demiurge 11y ago
I wish this was updated. I thought I'd check some things in python, and slide 37 about Python not treating characters as smallest units does not apply anymore. This seems valid:
Python 3.5.0 (default, Sep 22 2015, 12:32:59)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.72)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> g = "\N{GREEK SMALL LETTER ALPHA WITH VARIA AND YPOGEGRAMMENI}"
>>> print(g)
ᾲ
>>> print(re.search(r'\w', g))
<_sre.SRE_Match object; span=(0, 1), match='ᾲ'>
>>> p = "\N{MATHEMATICAL SCRIPT CAPITAL P}"
>>> print(p)
𝒫
>>> print(re.search(r'\w', p))
<_sre.SRE_Match object; span=(0, 1), match='𝒫'>
>>> print(re.search(r'..', p))
None
>>> print(re.search(r'.', p))
<_sre.SRE_Match object; span=(0, 1), match='𝒫'>
>>>