[Tutor] Converting a real map to a dictionary

2012-09-25 Thread Asmaa
Hello, I wonder if there is possibility to convert a map to a dictionary in python. My concern is getting the number of houses for specific area to return the coordination of the houses in this area. I can see that there are some useful codes to convert an address to its latitude and longitude

Re: [Tutor] Tutor Digest, Vol 103, Issue 124

2012-09-25 Thread Steven D'Aprano
On 26/09/12 02:06, Afzal Hossain wrote: hi i am trying to install python3.1.5 tgz in windows 7 but not getting exe file for installing.can u help me for this Hello and welcome! Four comments: Firstly, DO NOT reply to posts to start a new question. Always create a fresh new email, not a reply,

Re: [Tutor] Tutor Digest, Vol 103, Issue 124

2012-09-25 Thread Emile van Sebille
On 9/25/2012 9:06 AM Afzal Hossain said... hi i am trying to install python3.1.5 tgz in windows 7 but not getting exe file for installing.can u help me for this On 9/25/12, tutor-requ...@python.org wrote: http://www.catb.org/esr/faqs/smart-questions.html> If you're just starting out, save

Re: [Tutor] Usefulness of BIFs all() and any()?

2012-09-25 Thread Steven D'Aprano
On 26/09/12 02:11, Richard D. Moores wrote: On Tue, Sep 25, 2012 at 6:41 AM, Steven D'Aprano wrote: There are over a dozen examples of any or all in the Python standard library. How could I have gone about finding these examples? I tried searching the docs on any and all, but found them only

Re: [Tutor] Usefulness of BIFs all() and any()?

2012-09-25 Thread Richard D. Moores
On Tue, Sep 25, 2012 at 6:41 AM, Steven D'Aprano wrote: > There are over a dozen examples of any or all in the Python standard > library. How could I have gone about finding these examples? I tried searching the docs on any and all, but found them only in the BIF section,

Re: [Tutor] Tutor Digest, Vol 103, Issue 124

2012-09-25 Thread Afzal Hossain
Equivalent to: > > def any(iterable): > for element in iterable: > if element: > return True > return False > > Given a = [0, 1, 2, 3], > >>>> all(a) > False >>>> any(a) > True > > But so what? Could I ge

Re: [Tutor] Usefulness of BIFs all() and any()?

2012-09-25 Thread Richard D. Moores
Thanks for the great instruction, Tutors. I'd been working over a script of mine that factors integers. I noticed that if all the prime factors of n are the same, then if f is one of the factors and p is the number of factors, n = f ^ p. I thought of using all() or any(), but couldn't see how to d

Re: [Tutor] Usefulness of BIFs all() and any()?

2012-09-25 Thread Steven D'Aprano
On 25/09/12 23:41, Steven D'Aprano wrote: See also: http://en.wikipedia.org/wiki/Vacuous_truth And another useful link about vacuous truth: http://www.dailykos.com/story/2012/06/16/1087320/-Vacuous-truth -- Steven ___ Tutor maillist - Tutor@py

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-25 Thread Gregory Lund
> Why did you change file mode to "a"? I was trying different things and forgot to change it back before I cut/pasted. > > > dest_path = os.path.dirname(fullpath) > x.extractall(dest_path) > Ding ding ding, winner winner chicken dinner! It's working! Final .py stand alone code is: import os, os.

Re: [Tutor] Usefulness of BIFs all() and any()?

2012-09-25 Thread Steven D'Aprano
On 25/09/12 21:55, Richard D. Moores wrote: I was just perusing the Built-in Functions of Python 3.2 (< http://docs.python.org/py3k/library/functions.html>) and was wondering where would one ever use any() or all(). Both are very useful. They are especially useful for validating data, or for in

Re: [Tutor] Usefulness of BIFs all() and any()?

2012-09-25 Thread Dave Angel
On 09/25/2012 07:55 AM, Richard D. Moores wrote: > > > And why all([]) > True any([]) > False > > Same problem as calling sum() with an empty list. What value should it have? Clearly, it should return its 'start' parameter, which defaults to zero. Well the all() has a start value of

Re: [Tutor] Usefulness of BIFs all() and any()?

2012-09-25 Thread Hugo Arts
On Tue, Sep 25, 2012 at 1:55 PM, Richard D. Moores wrote: > I was just perusing the Built-in Functions of Python 3.2 (< > http://docs.python.org/py3k/library/functions.html>) and was wondering > where would one ever use any() or all(). > > But so what? Could I get some better examples? > I freque

[Tutor] Usefulness of BIFs all() and any()?

2012-09-25 Thread Richard D. Moores
I was just perusing the Built-in Functions of Python 3.2 (< http://docs.python.org/py3k/library/functions.html>) and was wondering where would one ever use any() or all(). all(iterable) Return True if all elements of the iterable are true (or if the iterable is empty). Equivalent to: def all(iter

Re: [Tutor] Unzipping a Zip of folders that have zips within them that I'd like to unzip all at once.

2012-09-25 Thread Peter Otten
Gregory Lund wrote: > if item.endswith('.zip'): > # Combine the base folder name with the subpath to the zip file > fullpath = os.path.join(outDir, item) > x = zipfile.ZipFile(fullpath,'a') Why did you change file mode to "a"? > x.extractall() > x.clos