reading hebrew text file
Fredrik Lundh
fredrik at pythonware.com
Mon Oct 17 10:31:31 EDT 2005
hagai26 at gmail.com wrote:
> I have a hebrew text file, which I want to read in python
> I don't know which encoding I need to use
that's not a good start. but maybe it's one of these:
http://sites.huji.ac.il/tex/hebtex_fontsrep.html
?
> how I do that
f = open(myfile)
text = f.readline()
followed by one of
text = text.decode("iso-8859-8")
text = text.decode("cp1255")
text = text.decode("cp862")
alternatively, use:
f = codecs.open(myfile, "r", encoding)
to get a stream that decodes things on the fly.
</F>
More information about the Python-list
mailing list