MRAB wrote:
> The string module still exists in Python 3.x, but the string functions
> which have been superseded by string methods have been removed.
Awesome, thanks for the heads up.
--
http://mail.python.org/mailman/listinfo/python-list
alex23 wrote:
On Apr 9, 8:52 am, Ben Racine wrote:
I have a list...
['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
'dir_330_error.dat']
I want to sort it based upon the numerical value only.
Does someone have an elegant solution to this?
This approach doesn't rely on knowing th
On Apr 9, 8:52 am, Ben Racine wrote:
> I have a list...
> ['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
> 'dir_330_error.dat']
> I want to sort it based upon the numerical value only.
> Does someone have an elegant solution to this?
This approach doesn't rely on knowing the format
Ben Racine writes:
> I have a list...
>
> ['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
> 'dir_330_error.dat']
>
> I want to sort it based upon the numerical value only.
>
> Does someone have an elegant solution to this?
I use code like the hack below to sort miscellaneous string
> How about a one liner?
>
> L.sort(key=lambda s: int(s.split('_')[1]))
>
> (Which is not necessarily elegant, but it is short.)
I grant it a measure of elegance as well.
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 9, 1:58 am, Chris Rebert wrote:
> On Thu, Apr 8, 2010 at 4:01 PM, Joaquin Abian wrote:
> > On Apr 9, 12:52 am, Ben Racine wrote:
> >> I have a list...
>
> >> ['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
> >> 'dir_330_error.dat']
>
> >> I want to sort it based upon the num
On Thu, Apr 8, 2010 at 4:01 PM, Joaquin Abian wrote:
> On Apr 9, 12:52 am, Ben Racine wrote:
>> I have a list...
>>
>> ['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
>> 'dir_330_error.dat']
>>
>> I want to sort it based upon the numerical value only.
>>
>> Does someone have an eleg
On 04/09/10 08:52, Ben Racine wrote:
> I have a list...
>
> ['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
> 'dir_330_error.dat']
>
> I want to sort it based upon the numerical value only.
>
> Does someone have an elegant solution to this?
>
> Thanks,
> Ben R.
list.sort() and s
On Apr 9, 12:52 am, Ben Racine wrote:
> I have a list...
>
> ['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
> 'dir_330_error.dat']
>
> I want to sort it based upon the numerical value only.
>
> Does someone have an elegant solution to this?
>
> Thanks,
> Ben R.
not sure about elega
Ben Racine wrote:
I have a list...
['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
'dir_330_error.dat']
I want to sort it based upon the numerical value only.
Does someone have an elegant solution to this?
Thanks,
Ben R.
How about a one liner?
L.sort(key=lambda s: int
On Thu, Apr 8, 2010 at 3:52 PM, Ben Racine wrote:
> I have a list...
>
> ['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
> 'dir_330_error.dat']
>
> I want to sort it based upon the numerical value only.
a = ['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
'dir_330_error.
11 matches
Mail list logo