Re: string methods (warning, newbie)

2005-02-28 Thread TZOTZIOY
On Sun, 27 Feb 2005 18:12:17 -0700, rumours say that Steven Bethard <[EMAIL PROTECTED]> might have written: [snip Nick Coghlan's list comprehension] [STeVe] >On the other hand, filter doesn't do the same thing: > >py> s = u'The Beatles - help - 03 - Ticket to ride' >py> filter(str.isalpha, s) >Tr

Re: string methods (warning, newbie)

2005-02-28 Thread TZOTZIOY
On Sun, 27 Feb 2005 18:12:17 -0700, rumours say that Steven Bethard <[EMAIL PROTECTED]> might have written: [snip Nick Coghlan's list comprehension] [STeVe] >On the other hand, filter doesn't do the same thing: > >py> s = u'The Beatles - help - 03 - Ticket to ride' >py> filter(str.isalpha, s) >Tr

Re: string methods (warning, newbie)

2005-02-27 Thread Steven Bethard
Nick Coghlan wrote: Jimmy Retzlaff wrote: The approach you are considering may be easier than you think: filter(str.isalpha, 'The Beatles - help - 03 - Ticket to ride') 'TheBeatleshelpTickettoride' Hmm, I think this is a case where filter is significantly clearer than the equivalent list comprehen

Re: string methods (warning, newbie)

2005-02-27 Thread anthonyberet
Jimmy Retzlaff wrote: Anthonyberet wrote: Is there a string mething to return only the alpha characters of a string? eg 'The Beatles - help - 03 - Ticket to ride', would be 'TheBeatlesTickettoride' If not then how best to approach this? I have some complicated plan to cut the string into individual

Re: string methods (warning, newbie)

2005-02-26 Thread Nick Coghlan
Jimmy Retzlaff wrote: The approach you are considering may be easier than you think: filter(str.isalpha, 'The Beatles - help - 03 - Ticket to ride') 'TheBeatleshelpTickettoride' Hmm, I think this is a case where filter is significantly clearer than the equivalent list comprehension: Py> "".join(

Re: string methods (warning, newbie)

2005-02-26 Thread Terry Reedy
"anthonyberet" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Is there a string mething to return only the alpha characters of a > string? > eg 'The Beatles - help - 03 - Ticket to ride', would be > 'TheBeatlesTickettoride' I believe you can do this with string.translate (string

RE: string methods (warning, newbie)

2005-02-26 Thread Jimmy Retzlaff
Anthonyberet wrote: > Is there a string mething to return only the alpha characters of a string? > eg 'The Beatles - help - 03 - Ticket to ride', would be > 'TheBeatlesTickettoride' > > If not then how best to approach this? > I have some complicated plan to cut the string into individual > charac

Re: string methods (warning, newbie)

2005-02-26 Thread Peter Hansen
anthonyberet wrote: Is there a string mething to return only the alpha characters of a string? eg 'The Beatles - help - 03 - Ticket to ride', would be 'TheBeatlesTickettoride' If not then how best to approach this? I have some complicated plan to cut the string into individual characters and the

Re: string methods (warning, newbie)

2005-02-26 Thread anthonyberet
anthonyberet wrote: Is there a string mething [method] to return only the alpha characters of a string? eg 'The Beatles - help - 03 - Ticket to ride', would be 'TheBeatlesTickettoride' erm, no it wouldn't, it would be 'TheBeatleshelpTickettoride', but you get me, I am sure. If not then how bes

string methods (warning, newbie)

2005-02-26 Thread anthonyberet
Is there a string mething to return only the alpha characters of a string? eg 'The Beatles - help - 03 - Ticket to ride', would be 'TheBeatlesTickettoride' If not then how best to approach this? I have some complicated plan to cut the string into individual characters and then concatenate a new