|
@@ -0,0 +1,16 @@
|
|
|
+from googletrans import Translator
|
|
|
+import os
|
|
|
+
|
|
|
+
|
|
|
+translator = Translator()
|
|
|
+#sostiruire la rirectory
|
|
|
+os.chdir('C:\\Users\\fumaga\\Documents\\py\\')
|
|
|
+
|
|
|
+for numero in range (50,8500,50):
|
|
|
+ numeroch = str(numero)
|
|
|
+ f = open('small_file_'+ numeroch + '.txt', 'r', encoding ='utf-8')
|
|
|
+ contents = f.read()
|
|
|
+ result = translator.translate(contents, dest='it',src='auto')
|
|
|
+ with open('small_it_'+ numeroch + '.txt', 'w',errors='ignore') as f:
|
|
|
+ f.write(result.text)
|
|
|
+ print("Fine small_it"+ numeroch)
|