User Tools

Site Tools


doc:appunti:prog:python_unicode

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
doc:appunti:prog:python_unicode [2013/10/12 06:05] – [Input: lettura da database] niccolodoc:appunti:prog:python_unicode [2015/07/17 07:50] (current) – [Nomi di file e directory] niccolo
Line 107: Line 107:
 </code> </code>
  
 +===== Lettura file di testo =====
 +
 +Invece della semplice **''open()''** conviene l'omologa **''codecs.open()''**:
 +
 +<code python>
 +import codecs
 +for line in codecs.open("filename.txt", "r", "iso-8859-15", "replace"):
 +    print line.strip()
 +</code>
doc/appunti/prog/python_unicode.1381557901.txt.gz · Last modified: 2013/10/12 06:05 by niccolo