changeset 885:6df7507e6338

add script to remove unicode
author Jeff Hammel <k0scist@gmail.com>
date Wed, 24 Mar 2021 12:58:23 -0700
parents e5861cbbc4bb
children 8a86595a6f9c
files python/strip_unicode.py
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/python/strip_unicode.py	Wed Mar 24 12:58:23 2021 -0700
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+import string
+import sys
+
+
+def main(args=sys.argv[1:]):
+
+    if args:
+        message = ' '.join(args)
+    else:
+        message = sys.stdin.read()
+
+    print(''.join(i for i in message if i in string.printable))
+
+
+if __name__ == '__main__':
+    main()