Re: Delete all not allowed characters..

2007-10-25 Thread Zentrader
> And my problem this function replace the character to "" but i > want to " " > for example: > input: Exam%^^ple > output: Exam ple > I want to this output but in my code output "Example" I don't think anyone has addressed this yet. It would be if chr found_in_allowed_set: output_string

Re: Delete all not allowed characters..

2007-10-25 Thread Paul Hankin
On Oct 26, 12:05 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Thu, 25 Oct 2007 23:23:37 +0200, Michal Bozon wrote: > >> Repeatedly adding strings together in this way is about the most > >> inefficient, slow way of building up a long string. (Although I'm sure > >> somebod

Re: Delete all not allowed characters..

2007-10-25 Thread Steven D'Aprano
On Thu, 25 Oct 2007 23:23:37 +0200, Michal Bozon wrote: >> Repeatedly adding strings together in this way is about the most >> inefficient, slow way of building up a long string. (Although I'm sure >> somebody can come up with a worse way if they try hard enough.) >> >> Even though recent version

Re: Delete all not allowed characters..

2007-10-25 Thread Zentrader
> allowed = > [u'+',u'0',u'1',u'2',u'3',u'4',u'5',u'6',u'7',u'8',u'9',u' ', u'Þ', > u'þ', u'Ö', u'ö', u'Ü', u'ü', u'Ç', u'ç', u'Ý', u'ý', u'Ð', u'ð', 'A', > 'C', 'B', 'E', 'D', 'G', 'F', 'I', 'H', 'K', 'J', 'M', 'L', 'O', 'N', > 'Q', 'P', 'S', 'R', 'U', 'T', 'W', 'V', 'Y', 'X', 'Z', 'a', 'c

Re: Delete all not allowed characters..

2007-10-25 Thread Michal Bozon
> >> the list comprehension does not allow "else", but it can be used in a >> similar form: >> ( I was wrong, as Tim Chase have shown ) >> s2 = "" >> for ch in s1: >> s2 += ch if ch in allowed else " " >> >> (maybe this could be written more nicely) > > Repeatedly adding strings together

Re: Delete all not allowed characters..

2007-10-25 Thread Steven D'Aprano
On Thu, 25 Oct 2007 07:52:36 -0700, Abandoned wrote: > Hi.. > I want to delete all now allowed characters in my text. I use this > function: > > def clear(s1=""): > if s1: > allowed = > [u'+',u'0',u'1',u'2',u'3',u'4',u'5',u'6',u'7',u'8',u'9',u' ', u'Ş', > u'ş', u'Ö', u'ö', u'Ü', u'ü',

Re: Delete all not allowed characters..

2007-10-25 Thread Steven D'Aprano
On Thu, 25 Oct 2007 17:42:36 +0200, Michal Bozon wrote: > the list comprehension does not allow "else", but it can be used in a > similar form: > > s2 = "" > for ch in s1: > s2 += ch if ch in allowed else " " > > (maybe this could be written more nicely) Repeatedly adding strings together i

Re: Delete all not allowed characters..

2007-10-25 Thread Tim Chase
> I want to delete all now allowed characters in my text. > I use this function: > > def clear(s1=""): > if s1: > allowed = > [u'+',u'0',u'1',u'2',u'3',u'4',u'5',u'6',u'7',u'8',u'9',u' ', u'Ş', > u'ş', u'Ö', u'ö', u'Ü', u'ü', u'Ç', u'ç', u'İ', u'ı', u'Ğ', u'ğ', 'A', > 'C', 'B', 'E', 'D

Re: Delete all not allowed characters..

2007-10-25 Thread Michal Bozon
On Thu, 25 Oct 2007 07:52:36 -0700, Abandoned wrote: > Hi.. > I want to delete all now allowed characters in my text. > I use this function: > > def clear(s1=""): > if s1: > allowed = > [u'+',u'0',u'1',u'2',u'3',u'4',u'5',u'6',u'7',u'8',u'9',u' ', u'Ş', > u'ş', u'Ö', u'ö', u'Ü', u'ü',

Re: Delete all not allowed characters..

2007-10-25 Thread Adam Donahue
On Oct 25, 10:52 am, Abandoned <[EMAIL PROTECTED]> wrote: > Hi.. > I want to delete all now allowed characters in my text. > I use this function: > > def clear(s1=""): > if s1: > allowed = > [u'+',u'0',u'1',u'2',u'3',u'4',u'5',u'6',u'7',u'8',u'9',u' ', u'Þ', > u'þ', u'Ö', u'ö', u'Ü', u'