[Tutor] WHAT IS THE DIFFERENCE BETWEEN FILTER AND REDUCE FUNCTION

2008-09-23 Thread sudhir . kumar
___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How Match a Dot?

2008-09-23 Thread Wayne Watson
Title: Signature.html I tried that in the re test program (Perl style-re tester) provided with Pyton 2.4 and ... Ah, I used /.  It works. But I also used \. Well, I see the culprit. I had one too many \d in: dateRe = re.compile(r'v\d\d\d\d\d\d\d\d_\d\d\d\d\d\d\.\d\d.*') Got it. Thanks. Kent Jo

Re: [Tutor] Sorting Dictionary of Dictionary by certain Value

2008-09-23 Thread Kent Johnson
On Tue, Sep 23, 2008 at 8:41 PM, Joe Python <[EMAIL PROTECTED]> wrote: > Hi Pythonistas, > > I have a large dictionary of dictionary (50,000+ keys) which has a structure > as follows: > DoD = { > 'flintstones' : { > 'husband' : "fred", > 'pal' : "barney", > '

Re: [Tutor] How Match a Dot?

2008-09-23 Thread Kent Johnson
On Tue, Sep 23, 2008 at 10:02 PM, Wayne Watson <[EMAIL PROTECTED]> wrote: > How do I match a dot in, for example, abc.txt? I want to match it exactly. > There must be some sort of escape. Assuming you want to match in a regular expression, use \ as an escape and use raw strings. In [40]: import r

[Tutor] How Match a Dot?

2008-09-23 Thread Wayne Watson
Title: Signature.html How do I match a dot in, for example, abc.txt? I want to match it exactly. There must be some sort of escape. -- Wayne Watson (Watson Adventures, Prop., Nevada City, CA) (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time) "

Re: [Tutor] Sorting Dictionary of Dictionary by certain Value

2008-09-23 Thread Robert Berman
This might help you. http://blog.modp.com/2008/09/sorting-python-dictionary-by-value-take.html Robert Joe Python wrote: Hi Pythonistas, I have a large dictionary of dictionary (50,000+ keys) which has a structure as follows: DoD = {     'flintstones' : {     'husband'   : "fre

Re: [Tutor] Sorting Dictionary of Dictionary by certain Value

2008-09-23 Thread Bill Campbell
On Tue, Sep 23, 2008, Bill Campbell wrote: >On Wed, Sep 24, 2008, John Fouhy wrote: >>2008/9/24 Joe Python <[EMAIL PROTECTED]>: >>> Hi Pythonistas, >>> >>> I have a large dictionary of dictionary (50,000+ keys) which has a structure >>> as follows: >>[snip] >>> I want to sort the dictionary by 'inc

Re: [Tutor] Sorting Dictionary of Dictionary by certain Value

2008-09-23 Thread Bill Campbell
On Wed, Sep 24, 2008, John Fouhy wrote: >2008/9/24 Joe Python <[EMAIL PROTECTED]>: >> Hi Pythonistas, >> >> I have a large dictionary of dictionary (50,000+ keys) which has a structure >> as follows: >[snip] >> I want to sort the dictionary by 'income' >> Is there an efficient way to do the same. >

Re: [Tutor] Sorting Dictionary of Dictionary by certain Value

2008-09-23 Thread John Fouhy
2008/9/24 Joe Python <[EMAIL PROTECTED]>: > Hi Pythonistas, > > I have a large dictionary of dictionary (50,000+ keys) which has a structure > as follows: [snip] > I want to sort the dictionary by 'income' > Is there an efficient way to do the same. Note that you cannot sort a dictionary. The bes

[Tutor] Sorting Dictionary of Dictionary by certain Value

2008-09-23 Thread Joe Python
Hi Pythonistas, I have a large dictionary of dictionary (50,000+ keys) which has a structure as follows: DoD = { 'flintstones' : { 'husband' : "fred", 'pal' : "barney", 'income': 500, }, 'jetsons' : { 'husband' : "george", 'wif

Re: [Tutor] image processing

2008-09-23 Thread Emile van Sebille
jeremiah wrote: I'm trying to do simple image manipulation but am getting an error. any ideas what i am doing wrong here? Thanks JJ #!/usr/bin/python import ImageFilter,Image name="test.jpg" file=open("./"+name,"w") Right here you're opening the file in write mode, in effect creating a new f

Re: [Tutor] please explain this error

2008-09-23 Thread Steve Willoughby
On Tue, Sep 23, 2008 at 06:13:31PM -0400, Herold Kroh wrote: > libsvn._core.SubversionException: ("Can't remove > 'SVN_skill/db/transactions/0-1.txn': Directory not empty", 39) > > I go to the offending directory and I see a .nfs file. When I > touch the file, it disappears. The problem here is

[Tutor] please explain this error

2008-09-23 Thread Herold Kroh
Hi all, New to this python thing.. I am trying to run a python script to convert sccs data to svn data (sccs2svn.py). Downloaded this off the web, and it sounds like it should do what I need it to, but I can not seem to get it to run. I keep getting the following error message: Traceback (m

Re: [Tutor] image processing

2008-09-23 Thread Jerry Hill
On Tue, Sep 23, 2008 at 5:38 PM, jeremiah <[EMAIL PROTECTED]> wrote: > I'm trying to do simple image manipulation but am getting an error. any > ideas what i am doing wrong here? > > file=open("./"+name,"w") > pic=Image.open(file) You're opening the file for "w"riting, then asking PIL to read it.

[Tutor] image processing

2008-09-23 Thread jeremiah
I'm trying to do simple image manipulation but am getting an error. any ideas what i am doing wrong here? Thanks JJ #!/usr/bin/python import ImageFilter,Image name="test.jpg" file=open("./"+name,"w") pic=Image.open(file) pic.rotate(45) pic.save("new_" + name) pic.show() the error: Traceback (mo

Re: [Tutor] array of different datatypes

2008-09-23 Thread Martin Walsh
Reed O'Brien wrote: > On Sep 22, 2008, at 11:50 PM, Steve Willoughby wrote: > >> Dinesh B Vadhia wrote: >>> Thanks Steve. How do you sort on the second element of each list to >>> get: >>> a' = [[42, 'fish'], >>>[1, 'hello'] >>>[2, 'world'] >>>] >> >> something like this w

Re: [Tutor] A question about how python handles numbers larger than it's 32 bit limit

2008-09-23 Thread Kent Johnson
On Tue, Sep 23, 2008 at 11:16 AM, John Toliver <[EMAIL PROTECTED]> wrote: > Greetings, > > The book I have says when you anticipate that you will be working with > numbers larger than what python can handle, you place an "L" after the > number to signal python to treat it as a large number. Your b

Re: [Tutor] A question about how python handles numbers larger than it's 32 bit limit

2008-09-23 Thread Steve Willoughby
On Tue, Sep 23, 2008 at 04:24:48PM +0100, Adam Bark wrote: > 2008/9/23 John Toliver <[EMAIL PROTECTED]> > > > Greetings, > > > > The book I have says when you anticipate that you will be working with > > numbers larger than what python can handle, you place an "L" after the > > number to signal py

Re: [Tutor] A question about how python handles numbers larger than it's 32 bit limit

2008-09-23 Thread Adam Bark
2008/9/23 John Toliver <[EMAIL PROTECTED]> > Greetings, > > The book I have says when you anticipate that you will be working with > numbers larger than what python can handle, you place an "L" after the > number to signal python to treat it as a large number. Does this > "treating" of the number

[Tutor] A question about how python handles numbers larger than it's 32 bit limit

2008-09-23 Thread John Toliver
Greetings, The book I have says when you anticipate that you will be working with numbers larger than what python can handle, you place an "L" after the number to signal python to treat it as a large number. Does this "treating" of the number only mean that Python won't try to represent the numbe

Re: [Tutor] array of different datatypes

2008-09-23 Thread Reed O'Brien
On Sep 22, 2008, at 11:50 PM, Steve Willoughby wrote: Dinesh B Vadhia wrote: Thanks Steve. How do you sort on the second element of each list to get: a' = [[42, 'fish'], [1, 'hello'] [2, 'world'] ] something like this would do the trick: a_prime = sorted(a, key=(lambd