how to translate each and every row of csv file

439 Views Asked by At

some words of the row are getting translated, sometimes and sometimes not.

from googletrans import Translator
myfile=open("ElectricCarData_Norm.csv")
f=myfile.readlines()

translator=Translator()  
with open("Electric.csv", 'w',encoding="utf-8") as op:      
  for line in f:
    #print(line)
    translation = translator.translate(line, src='en',dest='hi').text
    
  #print(line," ",translation)
    op.write(translation)
    op.write('\n')
0

There are 0 best solutions below