-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathID.py
More file actions
29 lines (26 loc) · 737 Bytes
/
ID.py
File metadata and controls
29 lines (26 loc) · 737 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
lowercase = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o",
"p", "q", "r", "s", "t", "u", "v", "w", "x", "z"]
uppercase = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R",
"S","T","U","V","W","X","Y","Z"]
digit = ["1","2","3","4","5","6","7","8","9","0","_"]
#pass in a string, if all characters are found in 3 arrays above it will be true
def is_ID(a):
try:
a.index('"')
return False
except:
pass
try:
a.index("'")
return False
except:
pass
try:
int(a[0])
return False
except:
pass
k = all(i in digit or uppercase or lowercase for i in a)
if k:
print '(ID "%s")' % a
return k