Fwd: Re: create lowercase strings in lists - was: (No subject)

2004-12-17 Thread Mark Devine
I got this working now. Thanks everybody for your help. _ Sign up for eircom broadband now and get a free two month trial.* Phone 1850 73 00 73 or visit http://home.eircom.net/broadbandoffer --- Begin Message --- Happy to help. Pass

Re: create lowercase strings in lists - was: (No subject)

2004-12-17 Thread Steve Holden
Mark Devine wrote: I got the script working. Thanks for all your help everyone. Trouble is its not showing the correct results. Here is the script and results: Well, that's a pretty unusual interpretation of the word "working" :-) > [...] I see from later postings you are getting closer to an answ

Re: create lowercase strings in lists - was: (No subject)

2004-12-17 Thread Peter Otten
Mark Devine wrote: > I got the script working. Thanks for all your help everyone. Trouble is > its not showing the correct results. Here is the script and results: In my book it is not working then. > def normalize(text, unwanted = "()", table = > string.maketrans(string.ascii_uppercase,string.a

Re: create lowercase strings in lists - was: (No subject)

2004-12-17 Thread Mark Devine
If I use: if el.issubset(testelement): I get a closer anwser but the brackets cause a problem. They are optional in the test list so (D) in the test list is equal to D or (D) in the reference list. "Mark Devine" <[EMAIL PROTECTED]> wrote: > > I got the script working. Thanks for all your he

Re: create lowercase strings in lists - was: (No subject)

2004-12-17 Thread Mark Devine
I got the script working. Thanks for all your help everyone. Trouble is its not showing the correct results. Here is the script and results: #!/usr/bin/env python import os import sys import time import string import pexpect import commands from sets import Set as set # Test if the words of lis

Re: create lowercase strings in lists - was: (No subject)

2004-12-17 Thread Mark Devine
Thanks. This version is the version that comes with cygwin. They must be behind. Steven Bethard <[EMAIL PROTECTED]> wrote: > > Mark Devine wrote: > > the trouble is it throws up the following error for set: > > > > $ ./test.py > > Traceback (most recent call last): > > File "./test.py", line

Re: create lowercase strings in lists - was: (No subject)

2004-12-17 Thread Steven Bethard
Mark Devine wrote: the trouble is it throws up the following error for set: $ ./test.py Traceback (most recent call last): File "./test.py", line 23, in ? reflist = [normalize(element) for element in list1] File "./test.py", line 20, in normalize return set(text.split()) NameError: glob

Re: create lowercase strings in lists - was: (No subject)

2004-12-17 Thread Mark Devine
Thanks for the help. This is the final script: #!/usr/bin/env python import os import sys import time import string import pexpect import commands # Test if the words of list2 elements appear in any order in list1 elements # disregarding case and parens # Reference list list1 = ["a b C (D)", "D

Re: create lowercase strings in lists - was: (No subject)

2004-12-17 Thread Michael Spencer
Bengt Richter wrote: On Fri, 17 Dec 2004 02:06:01 GMT, Steven Bethard <[EMAIL PROTECTED]> wrote: Michael Spencer wrote: ... conv = "".join(char.lower() for char in text if char not in unwanted) Probably a good place to use str.replace, e.g. conv = text.lower() for char in unwanted: conv =

Re: create lowercase strings in lists - was: (No subject)

2004-12-16 Thread Bengt Richter
On Fri, 17 Dec 2004 02:06:01 GMT, Steven Bethard <[EMAIL PROTECTED]> wrote: >Michael Spencer wrote: >> ... conv = "".join(char.lower() for char in text if char not in >> unwanted) > >Probably a good place to use str.replace, e.g. > >conv = text.lower() >for char in unwanted: > conv = con

Re: create lowercase strings in lists - was: (No subject)

2004-12-16 Thread Steven Bethard
Michael Spencer wrote: ... conv = "".join(char.lower() for char in text if char not in unwanted) Probably a good place to use str.replace, e.g. conv = text.lower() for char in unwanted: conv = conv.replace(char, '') Some timings to support my assertion: =) C:\Documents and Settings\Steve>

Re: create lowercase strings in lists - was: (No subject)

2004-12-16 Thread Mike Meyer
Steve Holden <[EMAIL PROTECTED]> writes: > Mark Devine wrote: > >> Actually what I want is element 'class-map match-all cmap1' from list 1 to >> match 'class-map cmap1 (match-all)' or 'class-map cmap1 mark match-all done' >> in list 2 but not to match 'class-map cmap1'. >> Each element in both l

Re: create lowercase strings in lists - was: (No subject)

2004-12-16 Thread Michael Spencer
Steve Holden wrote: Mark Devine wrote: Actually what I want is element 'class-map match-all cmap1' from list 1 to match 'class-map cmap1 (match-all)' or 'class-map cmap1 mark match-all done' in list 2 but not to match 'class-map cmap1'. Each element in both lists have multiple words in them. If a

Re: create lowercase strings in lists - was: (No subject)

2004-12-16 Thread Mark Devine
Actually what I want is element 'class-map match-all cmap1' from list 1 to match 'class-map cmap1 (match-all)' or 'class-map cmap1 mark match-all done' in list 2 but not to match 'class-map cmap1'. Each element in both lists have multiple words in them. If all the words of any element of the fir

Re: create lowercase strings in lists - was: (No subject)

2004-12-16 Thread Steve Holden
Mark Devine wrote: Actually what I want is element 'class-map match-all cmap1' from list 1 to match 'class-map cmap1 (match-all)' or 'class-map cmap1 mark match-all done' in list 2 but not to match 'class-map cmap1'. Each element in both lists have multiple words in them. If all the words of any el

Re: create lowercase strings in lists - was: (No subject)

2004-12-16 Thread Mike Meyer
"Mark Devine" <[EMAIL PROTECTED]> writes: > Sorry for not putting a subject in the last e-mail. The function lower suited > my case exactly. Here however is my main problem: > Given that my new list is : > [class-map match-all cmap1', 'match ip any', 'class-map match-any cmap2', > 'match any', '

Re: create lowercase strings in lists - was: (No subject)

2004-12-16 Thread Steve Holden
Mark Devine wrote: Sorry for not putting a subject in the last e-mail. The function lower suited my case exactly. Here however is my main problem: Given that my new list is : [class-map match-all cmap1', 'match ip any', 'class-map match-any cmap2', 'match any', 'policy-map policy1', 'class cmap1'

Re: create lowercase strings in lists - was: (No subject)

2004-12-16 Thread Mark Devine
Sorry for not putting a subject in the last e-mail. The function lower suited my case exactly. Here however is my main problem: Given that my new list is : [class-map match-all cmap1', 'match ip any', 'class-map match-any cmap2', 'match any', 'policy-map policy1', 'class cmap1', 'policy-map polic

create lowercase strings in lists - was: (No subject)

2004-12-16 Thread Diez B. Roggisch
Helpful subjects help commands = [c.lower() for c in commands] -- Regards, Diez B. Roggisch -- http://mail.python.org/mailman/listinfo/python-list