san wrote:
>
> Please let me know how to sort the list of String in either ascending /
> descending order without considering
> special characters and case.
> ex: list1=['test1_two','testOne','testTwo','test_one']
> Applying the l
On 2012-11-27 17:31, san wrote:
Please let me know how to sort the list of String in either ascending /
descending order without considering special characters and case.
ex: list1=['test1_two','testOne','testTwo','test_one']
Applying the list.so
Please let me know how to sort the list of String in either ascending /
descending order without considering special characters and case.
ex: list1=['test1_two','testOne','testTwo','test_one']
Applying the list.sort /sorted method results in sorted
Wow! Thanks for all of the great additional feedback and responses
since I last checked in. The help this group provides is amazing.
I'm glad I found it.
@Andrew -- Thanks for the clarification on the nested for loop and how
to intrepret it. Also, thanks for the information on generators. I
ha
> n = []
> for k in a:
> n.append([int(v) for v in k])
> print n
>
> Does anyone know what I am doing wrong?
>
> Thanks in advance.
>
> Samir
Use extend instead of append:
* Append -> add the one item to the end of the list
* Extend -> add the list of items to the end of the list
--
http://ma
Just to throw my hat in the ring, this is another way you can do this:
[(lambda x : [int(ii) for ii in x])(y) for y in a]
However, I do think dusans way is more elegant.
Best,
R
On Tue, Jul 22, 2008 at 4:58 PM, dusans <[EMAIL PROTECTED]> wrote:
> >>> a = [['1', '2'], ['3'], ['4', '5', '6'], [
>>> a = [['1', '2'], ['3'], ['4', '5', '6'], ['7', '8', '9', '0']]
>>> [map(int, i) for i in a]
[[1, 2], [3], [4, 5, 6], [7, 8, 9, 0]]
On Jul 21, 9:06 pm, Samir <[EMAIL PROTECTED]> wrote:
> Hi Everyone,
>
> I am relatively new to Python so please forgive me for what seems like
> a basic question.
Samir wrote:
For my small list, I didn't notice a
discernible increase in speed, but I may have to try it with a larger
list size.
About speed, and memory consumption:
List comprehensions
(http://docs.python.org/tut/node7.html#SECTION00714) are
just shortcuts for for-loops.
Samir wrote:
On Jul 21, 6:15 pm, Andrew Freeman <[EMAIL PROTECTED]> wrote:
Samir wrote:
On Jul 21, 3:20 pm, Gary Herron <[EMAIL PROTECTED]> wrote:
Samir wrote:
Hi Everyone,
I am relatively new to Python so please forgive me for what seems like
a basic quest
On Jul 21, 6:15 pm, Andrew Freeman <[EMAIL PROTECTED]> wrote:
> Samir wrote:
> > On Jul 21, 3:20 pm, Gary Herron <[EMAIL PROTECTED]> wrote:
>
> >> Samir wrote:
>
> >>> Hi Everyone,
>
> >>> I am relatively new to Python so please forgive me for what seems like
> >>> a basic question.
>
> >>> Assume
Samir wrote:
On Jul 21, 3:20 pm, Gary Herron <[EMAIL PROTECTED]> wrote:
Samir wrote:
Hi Everyone,
I am relatively new to Python so please forgive me for what seems like
a basic question.
Assume that I have a list, a, composed of nested lists with string
representations o
On Jul 21, 4:44 pm, Gary Herron <[EMAIL PROTECTED]> wrote:
> Samir wrote:
> > On Jul 21, 3:20 pm, Gary Herron <[EMAIL PROTECTED]> wrote:
>
> >> Samir wrote:
>
> >>> Hi Everyone,
>
> >>> I am relatively new to Python so please forgive me for what seems like
> >>> a basic question.
>
> >>> Assume tha
Samir wrote:
On Jul 21, 3:20 pm, Gary Herron <[EMAIL PROTECTED]> wrote:
Samir wrote:
Hi Everyone,
I am relatively new to Python so please forgive me for what seems like
a basic question.
Assume that I have a list, a, composed of nested lists with string
representations o
On Jul 22, 6:11 am, Samir <[EMAIL PROTECTED]> wrote:
[snip]
> For some reason, the logic I posted seems to work ok while I'm using
> the Python shell, but when used in my code, the program just hangs.
> It never outputs the results. Below is the code in its entirety. Is
> there a problem with my
On Jul 21, 3:20 pm, Gary Herron <[EMAIL PROTECTED]> wrote:
> Samir wrote:
> > Hi Everyone,
>
> > I am relatively new to Python so please forgive me for what seems like
> > a basic question.
>
> > Assume that I have a list, a, composed of nested lists with string
> > representations of integers, suc
Samir wrote:
Hi Everyone,
I am relatively new to Python so please forgive me for what seems like
a basic question.
Assume that I have a list, a, composed of nested lists with string
representations of integers, such that
a = [['1', '2'], ['3'], ['4', '5', '6'], ['7', '8', '9', '0']]
I would l
Hi Everyone,
I am relatively new to Python so please forgive me for what seems like
a basic question.
Assume that I have a list, a, composed of nested lists with string
representations of integers, such that
a = [['1', '2'], ['3'], ['4', '5', '6'], ['7', '8', '9', '0']]
I would like to convert
james_027 wrote:
> Hi all,
>
>> This is fine IMO since the OP didn't specify the opposite.
>>
>
> Thanks for all your replies, though I don't understand quite well the
> going argument? What do you mean when you say "the OP didn't specify
> the opposite"?
>
> There reason for using regex is beca
Hi all,
> This is fine IMO since the OP didn't specify the opposite.
>
Thanks for all your replies, though I don't understand quite well the
going argument? What do you mean when you say "the OP didn't specify
the opposite"?
There reason for using regex is because I am going to use it in
Django'
Carsten Haese wrote:
> On Wed, 2007-09-26 at 15:13 -0300, Pablo Ziliani wrote:
>> Carsten Haese wrote:
>>> Unfortunately, that also matches margarine, mayonnaise, and octopus,
>>> just to name a few ;-)
>> (and so does the solution you sent before :)
>
> No, it doesn't.
>
s = set(['jan', 'fe
On Wed, 2007-09-26 at 15:13 -0300, Pablo Ziliani wrote:
> Carsten Haese wrote:
> > Unfortunately, that also matches margarine, mayonnaise, and octopus,
> > just to name a few ;-)
>
> (and so does the solution you sent before :)
No, it doesn't.
>>> s = set(['jan', 'feb', 'mar', 'apr', 'may', 'jun
Carsten Haese wrote:
> On Wed, 2007-09-26 at 12:49 -0400, Steve Holden wrote:
>> james_027 wrote:
>>> hi,
>>>
>>> how do I regex that could check on any of the value that match any one
>>> of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug',
>>> 'sep', 'oct', 'nov', 'dec'
>>>
>>> Th
Carsten Haese wrote:
> On Wed, 2007-09-26 at 12:49 -0400, Steve Holden wrote:
>> james_027 wrote:
>>> hi,
>>>
>>> how do I regex that could check on any of the value that match any one
>>> of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug',
>>> 'sep', 'oct', 'nov', 'dec'
>>>
>>> Th
On Wed, 2007-09-26 at 12:49 -0400, Steve Holden wrote:
> james_027 wrote:
> > hi,
> >
> > how do I regex that could check on any of the value that match any one
> > of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug',
> > 'sep', 'oct', 'nov', 'dec'
> >
> > Thanks
>
> >>> patr =
Carsten Haese wrote:
> On Wed, 2007-09-26 at 15:42 +, james_027 wrote:
>
>> hi,
>>
>> how do I regex that could check on any of the value that match any one
>> of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug',
>> 'sep', 'oct', 'nov', 'dec'
>>
>
> Why regex? You can si
james_027 wrote:
> hi,
>
> how do I regex that could check on any of the value that match any one
> of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug',
> 'sep', 'oct', 'nov', 'dec'
>
> Thanks
>>> patr = re.compile('jan|feb|mar|apr|may|jun|jul|aug|sep|nov|oct|dec')
>>> patr.mat
On Wed, 2007-09-26 at 15:42 +, james_027 wrote:
> hi,
>
> how do I regex that could check on any of the value that match any one
> of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug',
> 'sep', 'oct', 'nov', 'dec'
Why regex? You can simply check if the given value is contained
hi,
how do I regex that could check on any of the value that match any one
of these ... 'jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug',
'sep', 'oct', 'nov', 'dec'
Thanks
james
--
http://mail.python.org/mailman/listinfo/python-list
BranoZ wrote:
> "132443" is a 'subsubstring' "0134314244133" because:
For the record, that's called a "subsequence".
http://www.google.com/search?hl=en&q=subsequence
--
--Bryan
--
http://mail.python.org/mailman/listinfo/python-list
Dennis Lee Bieber wrote:
> On Thu, 18 Aug 2005 13:30:45 +0200, Mohammed Altaj <[EMAIL PROTECTED]>
> declaimed the following in comp.lang.python:
>
>
> > Thanks , but , this work for an ordered substrings , just like what we
> > had ['0132442\n', '13\n', '24\n'] , I would like to remove all
> > su
to quote you :
"['0134314244133', '132443', '234']
2nd and 3rd strings are also substrings from the 1st one , so it should
be removed "
Actually, no, the 2nd string does not substring match the first, nor
does the 3rd. If you are referring to matching individual characters,
then yes, characters
> Thanks , but , this work for an ordered substrings , just like what we
> had ['0132442\n', '13\n', '24\n'] , I would like to remove all
> substrings from the list , example
>
> ['0134314244133', '132443', '234']
>
>
> 2nd and 3rd strings are also substrings from the 1st one , so it should
> be
>
>
>
>
>
>Mohammed Altaj wrote:
>
>
>>Hi All
>>
>>I am having problem with delete line if its belong to another one , example
>>
>>
>
>I think, you mean to remove all lines that are substrings of another
>line.
>
>l =
33 matches
Mail list logo