felixbade

If white space is not counted...

Feb 4th, 2016
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. # Encodes a python file as white space
  2.  
  3. import sys
  4.  
  5. if len(sys.argv) < 2:
  6.     print('Usage: %s <python-file>' % sys.argv[0])
  7.     exit(1)
  8.  
  9. filename = sys.argv[1]
  10. original_code = open(filename).read()
  11.  
  12. code = "exec(''.join(chr(len(x)) for x in '"
  13. code += ' '.join('\t'*ord(x) for x in original_code)
  14. code += "'.split(' ')))"
  15.  
  16. print(code)
Advertisement
Add Comment
Please, Sign In to add comment