title: Stripping non printable characters from a string in python
body: <p>I use to run</p>
  
  <pre><code>$s =~ s/[^[:print:]]//g;
  </code></pre>
  
  <p>on Perl to get rid of non printable characters. </p>
  
  <p>In Python there's no POSIX regex classes, and I can't write [:print:] having it mean what I want. I know of no way in Python to detect if a character is printable or not. </p>
  
  <p>What would you do? </p>
  
  <p>EDIT: It has to support Unicode characters as well. The string.printable way will happily strip them out of the output. 
  curses.ascii.isprint will return false for any unicode character.</p>