"Shani" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I have the following code which takes a list of urls > "http://google.com", without the quotes ofcourse, and then saves there > source code as a text file. I wan to alter the code so that for the > list of URLs an html file is saved. > > -----begin----- > import urllib > urlfile = open(r'c:\temp\url.txt', 'r') > for lines in urlfile: > try: > outfilename = lines.replace('/', '-') > urllib.urlretrieve(lines.strip('/n'), 'c:\\temp\\' \ > + outfilename.strip('\n')[7:] + '.txt') > except: > pass > -----end----- >
Is this what you mean? -----begin----- import urllib urlfile = open(r'c:\temp\url.txt', 'r') for lines in urlfile: try: outfilename = lines.replace('/', '-') urllib.urlretrieve(lines.strip('/n'), 'c:\\temp\\' \ + outfilename.strip('\n')[7:] + '.html') except: pass -----end----- Louis -- http://mail.python.org/mailman/listinfo/python-list