-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEditURLFile.py
More file actions
58 lines (54 loc) · 1.61 KB
/
EditURLFile.py
File metadata and controls
58 lines (54 loc) · 1.61 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
''' NOT FINISHED
from sys import exit
def urllen(text):
while len(text) < 60:
text+=' '
return text
def choosearg(inp):
if inp == 'name':
return True
elif inp == 'url':
return False
else:
return 'ERR'
with open('URLS.TXT', 'r', encoding='utf-8-sig') as f:
data = f.readlines()
f.close()
print('-----------------------------------------')
urllist=[]
namelist=[]
for i in data:
urllist.append(i.split(' ')[0])
namelist.append(i.split(' ')[-1].strip('\n').strip('\r'))
print('| {} | {} '.format(urllen(i.split(' ')[0]), urllen(i.split(' ')[-1].strip('\n').strip('\r'))))
print('-----------------------------------------')
while True:
userinput=input('>>')
if userinput=='exit':
exit()
elif userinput=='help':
print()
elif userinput[:4]=='add ':
arg=choosearg(userinput[4:7])
elif userinput[:4]=='set ':
arg=choosearg(userinput[4:7])
if arg == 'ERR':
print('[ERR]Arg is illegal')
continue
elif arg == True:
vil = False
name = userinput[8:]
temp = 0
for x in namelist:
if x == name:
vil = True
break
temp += 1
if vil == False:
print('[ERR]THERE ARE NO URL NAME:' + name)
continue
elif userinput[:4]=='del ':
arg=choosearg(userinput[4:7])
elif userinput[:5] == 'save ':
else:
print('[ERROR]THIS COMMAND IS NOT EXIST')'''