Created
August 1, 2013 11:16
-
-
Save JuniorLima/6130466 to your computer and use it in GitHub Desktop.
Ler arquivos em Python com acentuação
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
file = request.FILES['file'] | |
dialect = csv_mod.Sniffer().sniff(codecs.EncodedFile(file,"utf-8").read(1024)) | |
file.open() | |
csv = csv_mod.DictReader( codecs.EncodedFile(file,"utf-8"), dialect=dialect ) |
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
#!/usr/bin/python | |
# -*- coding: utf-8 -*- | |
import codecs | |
arquivo = codecs.open('teste.txt', 'rb', encoding='utf-8') | |
for linha in arquivo : | |
print linha | |
arquivo.close() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Muito obrigado, resolveu um grande problema.