replacement for string.printable

Jay Loden python at jayloden.com
Wed Aug 15 19:44:32 EDT 2007


John K Masters wrote:
>>From what I have read the string module is obsolete and should not be
> used but I am working on a project that parses printable files created
> in a DOS program and creates a web page for each file. I am using the
> string.printable constant to determine which characters should be kept;
> the files contain many print control codes. There seems to be nothing
> like this in the string methods. isalnum() seems the nearest but gives
> false for '+' '!' etc.
> 
> I realise I could define a global string to cover this but wondered if
> there was another, better, way
> 
> Regards, John

I could be misunderstanding the docs, but my understanding is that only the following in the string module are deprecated: 

http://docs.python.org/lib/node42.html

The rest of the string module isn't going away, just the above. (List members, please correct me if I'm wrong here!). 

-Jay



More information about the Python-list mailing list