Конвертит все csv в utf8

1
2
3
4
5
6
for fname in ( filter( lambda x: x.endswith(".csv") , os.listdir(".") ) ):
finp = open( fname,"rt")
fout = open( fname.replace(".csv","-utf8.csv") ,"wt")
fout.write(finp.read().decode("cp1251").encode("utf-8"))
fout.close()
finp.close()