file handling

James Mills prologic at shortcircuit.net.au
Mon Jun 14 01:57:26 EDT 2010


On Mon, Jun 14, 2010 at 3:35 PM, madhuri vio <madhuri.vio at gmail.com> wrote:
> i have a doubt about ...this..can u look into this..
>
> a = open("human.odt","r")
> b = a.readlines()
> print b
>
> and i get d output something else...
>
> python monday.py
> ["PK\x03\x04\x14\x00\x00\x00\x00\x00\xd6+\xce<^\xc62\x0c'\x00\x00\x00'\x00\x00\x00\x08\x00\x00\x00mimetypeapplication/vnd.oasis.opendocument.textPK\x03\x04\x14\x00\x00\x00\x00\x00\xd6+\xce<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1a\x00\x00\x00Configurations2/statusbar/PK\x03\x04\x14\x00\x08\x00\x08\x00\xd6+\xce<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'\x00\x00\x00Configurations2/accelerator/current.xml\x03\x00PK\x07\x08\x00\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00PK\x03\x04\x14\x00\x00\x00\x00\x00\xd6+\xce<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x18\x00\x00\x00Configurations2/floater/PK\x03\x04\x14\x00\x00\x00\x00\x00\xd6+\xce<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1a\x00\x00\x00Configurations2/popupmenu/PK\x03\x04\x14\x00\x00\x00\x00\x00\xd6+\xce<\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x1c\x00\x00\x00Configurations2/progressbar/PK\x03\x04\x14\x00\x00\x00\x00\
>
> something of this sort...i have asked this doubt earlier..noe i am unable to
> proceed...
> can u help me in this

What's the problem ? I don't see a question here.

.readlines() on a file object will attempt to read and parse
the input file line-by-line and give you a list of those lines.

If (however) there are no line endings in the file, you'll
get a list with only 1 item (the entire contents of the file).

Maybe this is what you're confused about ?

cheers
James



More information about the Python-list mailing list