read xml file from compressed file using gzip

flebber flebber.crue at gmail.com
Fri Jun 8 09:00:58 EDT 2007


On Jun 8, 9:45 pm, flebber <flebber.c... at gmail.com> wrote:
> On Jun 8, 3:31 pm, Stefan Behnel <stefan.behnel-n05... at web.de> wrote:
>
> > flebber wrote:
> > > I was working at creating a simple program that would read the content
> > > of a playlist file( in this case *.k3b") and write it out . the
> > > compressed "*.k3b" file has two file and the one I was trying to read
> > > was maindata.xml.
>
> > Consider using lxml. It reads in gzip compressed XML files transparently and
> > provides loads of other nice XML goodies.
>
> >http://codespeak.net/lxml/dev/
>
> > Stefan
>
> I will, baby steps at the moment for me at the moment though as I am
> only learning and can't get gzip to work

This is my latest attempt

#!/usr/bin/python

import os
import zlib

class gzip('/home/flebber/oddalt.k3b', 'rb')

main_data = os.system(open("/home/flebber/maindata.xml"));

for line in main_data:
	print line

main_data.close()








More information about the Python-list mailing list