Danny,

This script has to do two things:

1) Hit a site where I would like to download something

2) Read it what the file

3) Download it locally.

I'm a beginner, but according to what it is printing I'm thinking it is opening and is able to read the site (I'm wrong since I have been studying Python for the past two weeks).

import urllib
import sys

# Get a file-like object from the web and store it locally.

url = ""http://www.co.rowan.nc.us/enviroservs/planning_data/countyline.zip">http://www.co.rowan.nc.us/enviroservs/planning_data/countyline.zip"
# connect to the remote
try:
    remote = urllib.urlopen(url)
except:
    print "Connot open URL"
    sys.exit()
# Read from the object, storing the page's contents in 's'.
s = f.read()

====I'm thinking that up to this level, the script is fine.=========


m = "D\\Temp\\file"
print remote.info()
m = urllib.urlretrieve  ==> Not sure here
print "Content:"
print s
print "Download Done"
f.close()

Matt

 

 


From:  Danny Yoo <[EMAIL PROTECTED]>
To:  MATATA EMMANUEL <[EMAIL PROTECTED]>
CC:  Tutor@python.org
Subject:  Re: [Tutor] Download file from the web and store it locally.
Date:  Mon, 22 May 2006 13:05:13 -0700 (PDT)
>
>
>On Mon, 22 May 2006, MATATA EMMANUEL wrote:
>
>>I just made some changes, but I still can't get my file saved on my
>>local
>>drive:
>
>Ok.  Up to what part of the program works?
>
>Don't just say it doesn't work: can you try isolating what parts are
>working as expected, and what parts aren't working as expected?  Can
>you at least point at what you see wrong?
>
>I do see something weird here, but I want to make sure you can see
>it too.
>
>I guess I'm trying to say: don't use us on Tutor as a simple program
>or syntax checker.  *grin* You should try figuring things out to the
>best of your abilities too, so that you can learn how to get better.
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to