Instead of saving text files i need as html
3c273
nospam at nospam.com
Thu Jun 8 13:13:55 EDT 2006
"3c273" <nospam at nospam.com> wrote in message
news:e69k8a01ud4 at enews2.newsguy.com...
> Or is this what you mean?
> -----begin-----
> import urllib
> urlfile = open('c:\\temp\\url.txt', 'r')
> newurlfile = open('c:\\temp\\newurls.html', 'w')
> newurlfile.write('<html> \n<body>\n')
> for lines in urlfile:
> try:
> if lines == '\n':
> pass
> else:
> lines = '<a href="' + lines.strip() +'">'\
> + lines.strip() + '</a>' + '<br>\n'
> newurlfile.write(lines)
> except:
> pass
> newurlfile.write('</body> \n</html>')
> urlfile.close()
> newurlfile.close()
> -----end-----
> Louis
>
Oops, I guess we don't need "import urllib" anymore.
Louis
More information about the Python-list
mailing list