forked from 4dsolutions/python_camp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunicode_fun.py
More file actions
executable file
·86 lines (73 loc) · 2 KB
/
unicode_fun.py
File metadata and controls
executable file
·86 lines (73 loc) · 2 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# -*- coding: utf-8 -*-
"""
(c) Apache License
Demonstrates passing arguments from the OS shell (sys.argv)
Demonstrates unicode "strata" (unofficial term) in various
hexadecimal ranges
@author: Kirby Urner
"""
def emoji():
for codepoint in range(int('1F600', 16), int('1F620', 16)):
print(chr(codepoint), end=" ")
print()
def food_emoji():
emoji = [chr(codepoint) for codepoint in range(127812, 127857)]
for e in emoji:
print(e, end=" ")
print()
def hebrew():
global letters
letters = [chr(codepoint)
for codepoint in
range(int('05D0', 16),
int('05EB', 16))]
print("".join(letters))
print()
def greek():
for codepoint in range(int('03D0', 16), int('03FF', 16)):
print(chr(codepoint), end="")
print()
def korean():
for codepoint in range(int('BB00', 16), int('BBAF', 16)):
print(chr(codepoint), end="")
print()
def arabic():
print([chr(codepoint)
for codepoint in range(int('0681', 16),
int('06AF', 16))])
print()
def main():
print("\nEMOJI")
emoji()
print("\n\nHEBREW")
hebrew()
print("\n\nGREEK & COPTIC")
greek()
print("\n\nKOREAN")
korean()
print("\n\nARABIC")
arabic()
print()
def the_help():
print("$ python unicode_fun.py name\n"
"where name is:\n"
"arabic, hebrew, greek, korean, emoji, all\n")
menu_options = {
"arabic": arabic,
"hebrew": hebrew,
"greek": greek,
"korean": korean,
"emoji": emoji,
"all": main,
"--help": the_help,
"-h": the_help}
if __name__ == "__main__":
import sys
if len(sys.argv)>1:
requested_unicode = sys.argv[1]
# print(sys.argv)
if requested_unicode in menu_options:
# don't just eval() whatever is passed in!
menu_options[requested_unicode]()
else:
the_help()