[BangPypers] file handling

Supreet Sethi supreet.sethi at gmail.com
Mon Jun 14 11:48:14 CEST 2010


On Mon, 2010-06-14 at 11:48 +0530, madhuri vio wrote: 
> a = open("human","rb")
> print a.readlines()
> 
> 
> 
> this is the code i have
> written to read a text file but i am unable to ..
> i get a very weird output...
> "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
> 
> i am unable to proceed

You could try open via this sequence

>> import zipfile
>> z = zipfile.ZipFile("<filename here>")
>> z.infolist()

See if it helps

>> help(z)  for further reference on interactive python shell.



-- 
Supreet Sethi
Ph UK: +447859172473
Ph IN: +919811143517
Ph Skype: d_j_i_n_n
Profile: http://www.google.com/profiles/supreet.sethi
Twt: http://twitter.com/djinn




More information about the BangPypers mailing list