-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathclean.py
24 lines (21 loc) · 852 Bytes
/
clean.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
com1 = open('complete1.txt', encoding="utf8").read().split('\n')
com2 = open('complete2.txt', encoding="utf8").read().split('\n')
com3 = open('complete3.txt', encoding="utf8").read().split('\n')
com4 = open('complete4.txt', encoding="utf8").read().split('\n')
com5 = open('complete5.txt', encoding="utf8").read().split('\n')
com6 = open('complete6.txt', encoding="utf8").read().split('\n')
com = [com1, com2, com3, com4, com5, com6]
def clean(files):
text = []
for word in files:
each = word.split(',')
print(each)
audio = each[3].replace('audios/', '[sound:').replace('3','3]')
plus = word+","+audio
text.append(plus)
return text
for i in range(0,6):
file = clean(com[i])
with open(f'anki{i+1}.txt', 'w',encoding='utf8') as f:
for item in file:
f.write("%s\n" % item)