annotate python/strip_unicode.py @ 924:fc88a12acf48 default tip

add lfs filter
author Jeff Hammel <k0scist@gmail.com>
date Wed, 04 Dec 2024 15:50:53 -0800
parents 6df7507e6338
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
885
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
1 #!/usr/bin/env python
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
2
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
3 import string
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
4 import sys
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
5
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
6
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
7 def main(args=sys.argv[1:]):
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
8
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
9 if args:
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
10 message = ' '.join(args)
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
11 else:
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
12 message = sys.stdin.read()
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
13
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
14 print(''.join(i for i in message if i in string.printable))
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
15
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
16
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
17 if __name__ == '__main__':
6df7507e6338 add script to remove unicode
Jeff Hammel <k0scist@gmail.com>
parents:
diff changeset
18 main()