Mercurial > hg > config
comparison python/strip_unicode.py @ 885:6df7507e6338
add script to remove unicode
| author | Jeff Hammel <k0scist@gmail.com> | 
|---|---|
| date | Wed, 24 Mar 2021 12:58:23 -0700 | 
| parents | |
| children | 
   comparison
  equal
  deleted
  inserted
  replaced
| 884:e5861cbbc4bb | 885:6df7507e6338 | 
|---|---|
| 1 #!/usr/bin/env python | |
| 2 | |
| 3 import string | |
| 4 import sys | |
| 5 | |
| 6 | |
| 7 def main(args=sys.argv[1:]): | |
| 8 | |
| 9 if args: | |
| 10 message = ' '.join(args) | |
| 11 else: | |
| 12 message = sys.stdin.read() | |
| 13 | |
| 14 print(''.join(i for i in message if i in string.printable)) | |
| 15 | |
| 16 | |
| 17 if __name__ == '__main__': | |
| 18 main() | 
