0
J'ai un gros fichier avec encodage utf16le (BOM).
Est-il possible de le convertir en UTF8 habituel en python?Python Fichier UTF16LE au codage UTF8
Quelque chose comme
file_old = open('old.txt', mode='r', encoding='utf-16-le')
file_new = open('new.txt', mode='w', encoding='utf-8')
text = file_old.read()
file_new.write(text.encode('utf-8'))
http://docs.python.org/release/2.3/lib/node126.html (- utf_16_le UTF-16LE)
ne fonctionne pas. Impossible de comprendre l'erreur "TypeError: doit être str, pas bytes".
python 3
http://docs.python.org/py3k/library/codecs.html#standard-encodings –