Delete all not allowed characters..

Zentrader zentraders at gmail.com
Thu Oct 25 20:30:57 EDT 2007


> ....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 += chr
else:
   output_string += " "
This Is Just A General Example of code to use.  You probably would not
use 'output_string +=' but whatever form the implementation takes, you
would use an if/else

 Nice, I did not know that string translation exists, but Abandoned
have
> defined allowed characters, so making a translation table for the
> unallowed characters, which would take nearly complete unicode character
> table would be inefficient.

And this is also bad logic.  If you use a 'not allowed', then
everything else will be included by default.  Any errors in the 'not
allowed' or deviations that use an additional unicode character will
be included by default.  You want to have the program include only
what it is told to include  IMHO.




More information about the Python-list mailing list