Lie Ryan, 14.01.2010 01:47:
On 01/14/10 06:56, Hugo Arts wrote:
On Wed, Jan 13, 2010 at 8:21 PM, Stefan Behnel stefan...@behnel.de wrote:
Hugo Arts, 13.01.2010 15:25:
Here is my solution for the general case:
from itertools import groupby
def alphanum_key(string):
t = []
for isdigit,
On Thu, Jan 14, 2010 at 10:13 AM, Stefan Behnel stefan...@behnel.de wrote:
Note that this won't work in Py3, where the cmp parameter is gone.
Stefan
And he's right again. I should've checked for that. Well, that makes a
CmpInt class the only other solution:
class CmpInt(int):
def
.
~~
--- On Tue, 1/12/10, Kent Johnson ken...@tds.net wrote:
From: Kent Johnson ken...@tds.net
Subject: Re: [Tutor] samples on sort method of sequence object.
To: Make Twilight ph4...@gmail.com
Cc: tutor@python.org
Date: Tuesday, January 12, 2010, 7:53
Albert-Jan Roskam, 13.01.2010 13:51:
Interesting. Can this also be used to make sorting of alphanumerical list items
in a 'numerical' way easier? E.g.:
x
['var_0', 'var_13', 'var_11', 'var_9', 'var_4', 'var_1', 'var_5', 'var_6',
'var_7', 'var_14', 'var_2', 'var_3', 'var_8', 'var_10',
2010/1/13 Albert-Jan Roskam fo...@yahoo.com
Interesting. Can this also be used to make sorting of alphanumerical list
items in a 'numerical' way easier?
x
['var_0', 'var_13', 'var_11', 'var_9', 'var_4', 'var_1', 'var_5', 'var_6',
'var_7', 'var_14', 'var_2', 'var_3', 'var_8', 'var_10',
.
~~
--- On Wed, 1/13/10, Sander Sweers sander.swe...@gmail.com wrote:
From: Sander Sweers sander.swe...@gmail.com
Subject: Re: [Tutor] samples on sort method of sequence object.
To: Albert-Jan Roskam fo...@yahoo.com
Cc: *tutor python tutor@python.org
Date: Wednesday, January 13, 2010, 2:14 PM
2010/1/13
...@gmail.com* wrote:
From: Sander Sweers sander.swe...@gmail.com
Subject: Re: [Tutor] samples on sort method of sequence object.
To: Albert-Jan Roskam fo...@yahoo.com
Cc: *tutor python tutor@python.org
Date: Wednesday, January 13, 2010, 2:14 PM
2010/1/13 Albert-Jan Roskam
fo
Hugo Arts, 13.01.2010 15:25:
Here is my solution for the general case:
from itertools import groupby
def alphanum_key(string):
t = []
for isdigit, group in groupby(string, str.isdigit):
group = ''.join(group)
t.append(int(group) if isdigit else group)
return t
Note
On Wed, Jan 13, 2010 at 8:21 PM, Stefan Behnel stefan...@behnel.de wrote:
Hugo Arts, 13.01.2010 15:25:
Here is my solution for the general case:
from itertools import groupby
def alphanum_key(string):
t = []
for isdigit, group in groupby(string, str.isdigit):
group =
On Wed, Jan 13, 2010 at 2:21 PM, Stefan Behnel stefan...@behnel.de wrote:
Hugo Arts, 13.01.2010 15:25:
Here is my solution for the general case:
from itertools import groupby
def alphanum_key(string):
t = []
for isdigit, group in groupby(string, str.isdigit):
group =
On 01/14/10 06:56, Hugo Arts wrote:
On Wed, Jan 13, 2010 at 8:21 PM, Stefan Behnel stefan...@behnel.de wrote:
Hugo Arts, 13.01.2010 15:25:
Here is my solution for the general case:
from itertools import groupby
def alphanum_key(string):
t = []
for isdigit, group in groupby(string,
On Thu, Jan 14, 2010 at 1:47 AM, Lie Ryan lie.1...@gmail.com wrote:
On 01/14/10 06:56, Hugo Arts wrote:
On Wed, Jan 13, 2010 at 8:21 PM, Stefan Behnel stefan...@behnel.de wrote:
Hugo Arts, 13.01.2010 15:25:
Here is my solution for the general case:
from itertools import groupby
def
Hi,there:
The document of
Python.org[http://docs.python.org/library/stdtypes.html] says that:
--
s.sort([cmp[, key[, reverse]]])
8. The sort() method takes optional arguments
On Tue, Jan 12, 2010 at 3:39 PM, Make Twilight ph4...@gmail.com wrote:
Hi,there:
The document of
Python.org[http://docs.python.org/library/stdtypes.html] says that:
snip
I can understand how to use parameters of cmp and reverse,except the
key parameter...
Would anyone give me an
On Tue, Jan 12, 2010 at 9:39 AM, Make Twilight ph4...@gmail.com wrote:
I can understand how to use parameters of cmp and reverse,except the
key parameter...
Would anyone give me an example of using sort method with key parameter?
http://personalpages.tds.net/~kent37/kk/7.html
Kent
15 matches
Mail list logo