Question about string.printable and non-printable characters

Daniel Alexandre daniel at designspots.com
Tue Mar 15 16:29:57 CET 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi there,

I'm using the following method in my program to check whether a message 
received is printable or not and to strip the non-printable characters:

CheckPrintable(self,message):
	printablemessage = ""
	for char in message:
		if char in string.printable: printablemessage = printablemessage + 
char
	return printablemessage

The method is working fine, except in one detail, it's also stripping 
the accented letters which I didn't want to happen. Is there a 
string.printable declaration which contains accented letters? Thanks in 
advance. If you can, please reply to my email.
- -- 
Best Regards,
Daniel Alexandre ( dfcruz at student.dei.uc.pt )
PGP Public Key: http://student.dei.uc.pt/~dfcruz/pubring.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (Darwin)

iD8DBQFCNv94L3+DjgQV3LgRAk0yAKDN5lzrXqsVY5zgvZD2X3oGtWS5IwCcCtsA
qv5d+KGP3n9Gbx0iUm46f/k=
=sw9h
-----END PGP SIGNATURE-----




More information about the Python-list mailing list