DeaD_EyE

unicodefun_py36.py

Jan 26th, 2017
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.77 KB | None | 0 0
  1. #!/usr/bin/env python3.6
  2.  
  3. """
  4. Ich musste mal einfach ein bisschen kreativ tätig sein.
  5. Ist bleeding edge. Python 3.6 required.
  6. """
  7.  
  8. import sys
  9. import unicodedata
  10. import string
  11.  
  12. uppercase = {c: unicodedata.lookup(f'Circled Latin Capital Letter {c}') for c in string.ascii_uppercase}
  13. number_names = ['ONE', 'TWO', 'THREE', 'FOUR', 'FIVE', 'SIX', 'SEVEN', 'EIGHT', 'NINE']
  14. numbers = {str(n): unicodedata.lookup(f'Circled Digit {number_names[n-1]}') for n in range(1, 10)}
  15.  
  16. def translate(text, fill=''):
  17.     return fill.join(uppercase.get(c) or numbers.get(c) or c for c  in text)
  18.  
  19. if __name__ == '__main__':
  20.     text = ' '.join(sys.argv[1:]) or 'Hallo Andre, 123'
  21.     result = translate(text.upper())
  22.     print(result)
  23.     # 'ⒽⒶⓁⓁⓄ ⒶⓃⒹⓇⒺ, ①②③'
Add Comment
Please, Sign In to add comment