[Baypiggies] Using urllib2 to print file contents line-by-line
Aahz
aahz at pythoncraft.com
Sat Dec 19 20:59:50 CET 2009
On Sat, Dec 19, 2009, ken barclay wrote:
>
> I'm running the backend on a Centos box.
>
> I do have a workaround but it requires an extra step from the user -
> I just print out the url on the output page, and when the user clicks
> the link, the browser takes care of loading the file into the browser
> and it looks exactly like it does in the file.
The question is, what OS are you running urlopen() on? I bet that it's
Windows. In which case the simple solution is to split() the data on
'\n' and then iterate over the lines.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
Looking back over the years, after I learned Python I realized that I
never really had enjoyed programming before.
More information about the Baypiggies
mailing list