Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- codes = {'A':'!', 'a':'0', 'B':'@', 'b':'9', 'C':'#',
- 'c':'8', 'D':'$', 'd':'7', 'E':'%', 'e':'6',
- 'F':'^', 'f':'5', 'G':'&', 'g':'4', 'H':'*',
- 'h':'3', 'I':';;', 'i':'2', 'J':'~', 'j':'1',
- 'K':'x', 'k':'?', 'L':'b', 'l':'Y', 'M':'e',
- 'm':'q', 'N':'a', 'n':'c', 'O':'f', 'o':'D',
- 'P':'j', 'p':'G', 'Q':'B', 'q':'J', 'R':'K',
- 'r':'E', 'S':'A', 's':'d', 'T':'I', 't':'L',
- 'U':'C', 'u':'>', 'V':'<', 'v':'/', 'W':'F',
- 'w':'k', 'X':'r', 'x':'R', 'Y':'t', 'y':'o',
- 'Z':'n', 'z':'s', ' ':' '}
- input_filename = 'text.txt'
- output_filename = 'encryption_words.txt'
- encrypted_text = ''
- with open(input_filename) as file_in:
- oryginal_text = file_in.read()
- for char in oryginal_text:
- if char in codes:
- encrypted_text += codes[char]
- print('oryginal:')
- print(oryginal_text)
- print('---')
- print('encrypted:')
- print(encrypted_text)
- with open(output_filename, 'w') as file_out:
- for i in range(0, len(encrypted_text), 50):
- file_out.write(encrypted_text[i:i+50])
- file_out.write('\n')
- print('---')
- print('Encrypted words save to', output_filename)
- with open(output_filename) as file_in:
- print(file_in.read())
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement