Hi Kent, You were right. The code worked fine. I was doing some thing wrong with some characters in my URL (for example: I had to change "&" to "&"). I'd like to thank you guys for your help.
Kent Johnson wrote: > Ronaldo wrote: >> Hi, Jean >> >> I've alredy tried this, but it seems that this kind of code just works >> when "file" in the url (http://www.somesite.com/file) is an html file. >> The thing is that "file" in this case is a text file. For example: if I >> try to download the file using a web browser, it asks me for a directory >> to save the file. >> Do you have any other idea? > > The code below should work fine for a text file. Can you show us the > code that fails and tell us how it fails? If you can include the URL > you are trying to download that would also help. > > Kent >> >> Thanks. >> >> Jean-Philippe Durand wrote: >>> Hello Ronaldo, >>> Try this : >>> import urllib >>> mysock = urllib.urlopen("http://www.somesite.com/file") >>> htmlSource = mysock.read() >>> mysock.close() >>> print htmlSource Regards. >>> Jean-Philippe DURAND > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor