[Tutor] read in text file containing non-English characters

Marc Tompkins marc.tompkins at gmail.com
Fri Jan 13 01:49:06 CET 2012

On Thu, Jan 12, 2012 at 1:20 PM, Francis P. Boscoe <fpb01 at health.state.ny.us
> wrote:

> Given a simple text file of departments, capitals, longitude and latitude
> separated by commas
> Ahuachapán,Ahuachapán,-89.8450,13.9190
> Cabañas,Sensuntepeque,-88.6300,13.8800
> Cuscatlán,Cojutepeque,-88.9333,13.7167
> I would like to know to how to read in the file and then access arbitary
> rows in the file, so that I can print a line such as:
> The capital of Cabañas is Sensuntepeque
> while preserving the non-English characters
> now, for example, I get
> Cabañas
I'm going to go out on a limb here and guess that you're not yet
comfortable with Unicode. It's all right - we've all been there, and
sometimes I still wake up in a cold sweat thinking about it - but you owe
it to yourself to get at least a bit more comfortable with encodings,
character sets, etc.
Joel Spolsky - Joel on Software - wrote a pretty good intro a few years
ago.  It's geared toward HTML, but the concepts are the same regardless of
language.  It's a fun read, and informative - I recommend
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120112/a55e6756/attachment.html>

More information about the Tutor mailing list