-
-
Save lpirir/a9f96b3b37083283a1e5809097c3a31b to your computer and use it in GitHub Desktop.
Cambiar codificación de caracteres de un archivo con python.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
file = 'file.csv' | |
outfile = 'out.csv' | |
f = open(file, 'rb') | |
# Windows Comma Separated (.csv) ~ ISO-8859-2 | CP1252 | |
content = unicode(f.read(), 'CP1252') | |
f.close() | |
out = open(outfile, 'wb') | |
out.write(content.encode('utf-8')) | |
out.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment