GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — example-code-2e/04-text-byte/numerics_demo.py at master · FerMatPy/example-code-2e Expand file tree/ Copy pathnumerics_demo.pyMore file actions 18 lines (15 loc) · 624 Bytes / Copy pathnumerics_demo.pyFile metadata and controls18 lines (15 loc) · 624 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 # tag::NUMERICS_DEMO[] import unicodedata import re re_digit = re.compile(r'\d') sample = '1\xbc\xb2\u0969\u136b\u216b\u2466\u2480\u3285' for char in sample: print(f'U+{ord(char):04x}', # <1> char.center(6), # <2> 're_dig' if re_digit.match(char) else '-', # <3> 'isdig' if char.isdigit() else '-', # <4> 'isnum' if char.isnumeric() else '-', # <5> f'{unicodedata.numeric(char):5.2f}', # <6> unicodedata.name(char), # <7> sep='\t') # end::NUMERICS_DEMO[] |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |