Re: [Tutor] loop questions

2013-04-07 Thread Alan Gauld
On 06/04/13 23:00, Soliman, Yasmin wrote: I have two questions on these simple programs: 1st why does this loop keep repeating after I enter 'Quit'? import calendar m = raw_input(“Enter a year: “) while m != “Quit”: if calendar.isleap(int(m)): print “%d is a leap year” % (int(m)) else:

[Tutor] urllib.urlretrieve ?

2013-04-07 Thread Matthew Ngaha
Im following a tutorial on what i believe is using Python 2 and i'm a bit confused. I use Python 3 on windows vista. I believe urlretrieve() is a python 2 function that isnt in 3, but why is the tutorial using urllib instead of urllib2? Also when i run the program on Python 3, it says:

Re: [Tutor] urllib.urlretrieve ?

2013-04-07 Thread eryksun
On Sun, Apr 7, 2013 at 11:07 AM, Matthew Ngaha chigga...@gmail.com wrote: so Python 3 doesnt recognize this function, i want to ask if there is an equivalent function to 'urlretrieve' in Python 3? The documentation is indexed: http://docs.python.org/3/genindex-U.html

Re: [Tutor] urllib.urlretrieve ?

2013-04-07 Thread Alan Gauld
On 07/04/13 16:07, Matthew Ngaha wrote: an equivalent function to 'urlretrieve' in Python 3? the program uses this function to download a file as so: urllib.urlretrieve(self._url, self._filename, reporthook) Looking in the V3 documents on the Python web site it says: == The

Re: [Tutor] urllib.urlretrieve ?

2013-04-07 Thread Matthew Ngaha
the whole program depends on the urlretrieve 3rd argument, the function to be called.. is there no options to include a callback? def _download(self): def reporthook(pos, block, total): if self.size != total: self._size = total

Re: [Tutor] urllib.urlretrieve ?

2013-04-07 Thread Matthew Ngaha
Look in the module docs for urlib.request. Hi. Ive never used the urllib before unless it was typing in something from an unrelated tutorial. I've also never done anything related to web programming. I'm looking at the urllib.request page and i really don't understand what i'm looking at. I'm

Re: [Tutor] urllib.urlretrieve ?

2013-04-07 Thread Joel Goldstick
On Sun, Apr 7, 2013 at 11:32 AM, Matthew Ngaha chigga...@gmail.com wrote: the whole program depends on the urlretrieve 3rd argument, the function to be called.. is there no options to include a callback? def _download(self): def reporthook(pos, block, total): if

Re: [Tutor] urllib.urlretrieve ?

2013-04-07 Thread Matthew Ngaha
You might want to look at requests module: http://docs.python-requests.org/en/latest/ Many people think it is easier to use than the native python support. are all of these modules related to web programming like clients and (HTTP)servers? I've come across urllib a lot of times but only

Re: [Tutor] urllib.urlretrieve ?

2013-04-07 Thread Alan Gauld
On 07/04/13 17:20, Matthew Ngaha wrote: Look in the module docs for urlib.request. Hi. Ive never used the urllib before In Python 3 urllib combines (the best) features of urllib and urllib2 from Python 2. web programming. I'm looking at the urllib.request page and i really don't

Re: [Tutor] urllib.urlretrieve ?

2013-04-07 Thread Matthew Ngaha
yeah, sadly urlretrieve doesnt exist on my version of python. i just need a function to put in the same line that replaces this one with the same arguments in order to see the results of my tutorial. urllib.urlretrieve(self._url, self._filename, reporthook) On Sun, Apr 7, 2013 at 7:10 PM, Alan

Re: [Tutor] urllib.urlretrieve ?

2013-04-07 Thread Mark Lawrence
On 07/04/2013 19:49, Matthew Ngaha wrote: Please don't top post. yeah, sadly urlretrieve doesnt exist on my version of python. i just need a function to put in the same line that replaces this one with the same arguments in order to see the results of my tutorial.

Re: [Tutor] urllib.urlretrieve ?

2013-04-07 Thread Matthew Ngaha
org/2/library/urllib.html#urllib.urlretrieve or http://docs.python.org/3/library/urllib.request.html#urllib.request.urlretrieve sorry about the top posting gmail has changed the way their messages are done, it gave me a blank field i didnt realize i was writing above the message. i must have

Re: [Tutor] urllib.urlretrieve ?

2013-04-07 Thread Bod Soutar
On 7 April 2013 20:59, Matthew Ngaha chigga...@gmail.com wrote: org/2/library/urllib.html#urllib.urlretrieve or http://docs.python.org/3/library/urllib.request.html#urllib.request.urlretrieve sorry about the top posting gmail has changed the way their messages are done, it gave me a blank

Re: [Tutor] urllib.urlretrieve ?

2013-04-07 Thread Matthew Ngaha
Unless you're looking for something specific from the URL that the tutorial uses, then you could use any address Bodsda thanks i did that and to my suprise an extra file showed up in my folder, of the page i just visited:) thanks ___ Tutor maillist