Spoiler to Python Challenge (help!!!)
i_vincent at hotmail.com
Tue Sep 27 15:32:22 CEST 2005
Damn this is annoying me.
I have a webpage with a BZ2 compressed text embedded in it looking like:
Now, if I simply copy and paste this into Python and decompress it - it
works a treat.
However, I want to read the file containing this data, extract the data
and decompress it and this for some reason does not work.
I am doing the following (excuse the probably very long handed way of
file = urllib.urlopen(url, proxies=proxies)
line = file.readlines()
line = line[20:]
line = line[:-1]
user = line
password = line
user = user[5:]
user = user[:-2]
user = str(user)
password = password[5:]
password = password[:-2]
This gives me a user string of:
But if I put this into the decompression function, I get a error of
'IOError: invalid data stream'.
I know it is the escape characters but how do I get these to be correctly
converted into a string compatible with bz2.decompress()?
More information about the Python-list