-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
33 lines (24 loc) · 993 Bytes
/
main.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
25
26
27
28
from deep_translator import GoogleTranslator
import csv
wordsave = []
trad = []
tradAL = []
tradEsp = []
i = 0
keys = ['Anglais', 'francais']
with open('name of the animals.txt', newline='') as csvfile:
with open("listeAnimaux.csv", "w", newline="") as csv_file:
spamreader = csv.reader(csvfile, delimiter=',', quotechar='|')
for row in spamreader:
word = (','.join(row))
wordsave.append(','.join(row))
translated = GoogleTranslator(source='auto', target='fr').translate(word)
allemand = GoogleTranslator(source='auto', target='de').translate(word)
espagnol = GoogleTranslator(source='auto', target='spanish').translate(word)
trad.append(translated)
tradAL.append(allemand)
tradEsp.append(espagnol)
print(espagnol)
writter = csv.writer(csv_file)
writter.writerow([wordsave[i], trad[i], tradAL[i], tradEsp[i]])
i = i + 1