Advertisement
Guest User

Untitled

a guest
Jan 13th, 2019
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. import sys
  2. script, input_encoding, error = sys.argv
  3.  
  4. def main(language_file, encoding, errors):
  5.     line = language_file.readline()
  6.    
  7.     if line:
  8.         print_line(line, encoding, errors)
  9.         return main(language_file, encoding, errors)
  10.        
  11. def print_line(line, encoding, errors):
  12.     next_lang = line.strip()
  13.     raw_bytes = next_lang.encode(encoding, errors=errors)
  14.     cooked_string = raw_bytes.decode(encoding, errors=errors)
  15.    
  16.     print(raw_bytes, "<===>", cooked_string)
  17.    
  18. language = open("languages.txt", encoding="utf-8")
  19.  
  20. main(language, input_encoding, error)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement