-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpalabras.py
More file actions
40 lines (31 loc) · 959 Bytes
/
Copy pathpalabras.py
File metadata and controls
40 lines (31 loc) · 959 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
37
38
__author__ = 'ekibalko'
import os
import re
import sys
def lookupword(word):
with open('C:\\temp\\palabras', 'r', encoding='UTF8') as myfile:
lines = myfile.readlines()
for line in lines:
if re.search(word,line):
index = lines.index(line)
if "•" not in lines[index+1]:
return " "
else:
return lines[index+1]
file = open('C:\\temp\\palabras.txt', 'r', encoding='UTF8')
output = open('C:\\temp\\anki5000.txt', 'w', encoding='UTF8')
#print(lookupword("gozar"))
lines = file.readlines()
for line in lines:
wordlist = line.split()
word = wordlist[0]+", "+wordlist[1] + ':' + ' '.join(wordlist[2:])
word.strip()
#print(word)
#output.write(word)
example = lookupword(wordlist[0])
example.strip()
#print(example)
output.write(word+example+"\n")
#output.write(example)
file.close()
output.close()