Hi tkc, Thanks so much.. it works! :-) I used the urllib.
and thanks also to everybody who replied. jtj On Thu, Jan 29, 2009 at 11:08 AM, Tim Chase <python.l...@tim.thechases.com>wrote: > Thanks for you reply. I am newbie in python. >> Im going to use HTTP. >> > > If all you want is to download a file, you might want to look into using > "wget" or "curl" (which work for both HTTP and FTP). E.g. > > bash$ wget http://myothermachine/path/to/file.html > > However, if you need to roll it into a script, Python's urllib module will > do the trick > > >>> import urllib > >>> url = "http://myothermachine/path/to/file.html" > >>> f = urlib.urlopen(url) > >>> out = file('python.txt', 'w') > >>> for line in f: out.write(line) > ... > >>> out.close() > >>> f.close() > > If the content is small, you can just use > > >>> content = f.read() > >>> out.write(content) > > instead of the "for line in f: out.write(line)". If you need to actually > parse the HTML that's returned, the common suggestion is to use the > BeautifulSoup add-on module which has worked for my needs. > > -tkc > > > > > > >
-- http://mail.python.org/mailman/listinfo/python-list