forked from WebJournal/journaldev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring_isdigit.py
More file actions
36 lines (27 loc) · 798 Bytes
/
string_isdigit.py
File metadata and controls
36 lines (27 loc) · 798 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
s = '100'
print(s.isdigit())
s = '0xF'
print(s.isdigit())
s = '10.55'
print(s.isdigit())
s = ''
print(s.isdigit())
s = '1٠2𝟜' # U+0660=0, U+1D7DC=4
print(s.isdigit())
print(int(s))
import unicodedata
count = 0
for codepoint in range(2 ** 16):
ch = chr(codepoint)
if ch.isdigit():
print(u'{:04x}: {} ({})'.format(codepoint, ch, unicodedata.name(ch, 'UNNAMED')))
count = count + 1
print(f'Total Number of Digit Unicode Characters = {count}')
import unicodedata
count = 0
for codepoint in range(2**16):
ch = chr(codepoint)
if ch.isnumeric() and not ch.isdigit():
print(u'{:04x}: {} ({})'.format(codepoint, ch, unicodedata.name(ch, 'UNNAMED')))
count = count + 1
print(f'Total Number of Numeric and Non-Digit Unicode Characters = {count}')