Wget is a very useful tool, however, I dont know how to use it in python. Below is my try but with no luck. Would you tell me the right way ? Thank you very much !!

I made a wwget.py


import urllib2, urllib


Running in termial

:~/abc$ ./wwget.py
Traceback (most recent call last):
File "./wwget.py", line 5, in <module>
NameError: name 'wget' is not defined

JDBurnZ commented: Very good question, not one that you're probably going to easily track down by browsing the Python documentation. +0

Recommended Answers

All 5 Replies

Thx sneekula and linux. I have tried and seems it is quite easy using linux's script to get the job done. Thanks.

Mark this as solved, please :)

If you're attempting to download a file in Python, it's very simple:

import urllib, os

# if you comment out this line, it will download to the directory from which you run the script.

url = 'http://www.mydomain.com/myfile.txt'
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.