Last active
March 6, 2021 19:16
-
-
Save ionatan-israel/996b8804b59268ab2192 to your computer and use it in GitHub Desktop.
Cambiar codificación de caracteres de un archivo con python.
This file contains 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