user = getpass.getuser() #define nome de usuário do computador
key_file = open(r'C:\Users\\' + user + "\Desktop\keycrypt100.py", "w") #diretório do arquivo a ser criado
key_file.write('''
import sys
lookfor = "Programinha.py"
d_texcrip = input('Insira o texto a ser utilizado: ')
d_texdecrip = '' #texto convertido
print('Isso pode levar alguns instantes')
d_user = getpass.getuser()
diret = "C:\\Users\\" + d_user
for root, dirs, files in os.walk(diret): #procura o diretório de Programinha para importar uma variável X
if lookfor in files:
endereco = join(root, lookfor) #define o diretório da variável X
break
sys.path.insert(0, endereco)
from endereco import crcod #importou a variável
d_decrip_crcod = {v: k for k, v in crcod.items()} #variável X é invertida
for i in d_texcrip:
if i in d_decrip_crcod:
d_texdecrip += a[i]
else:
d_texdecrip += i
print('O texto convertido é:', d_texdecrip)
input()''')
key_file = open(r'C:\Users\\' + user + "\Desktop\keycrypt100.py", "r")
key_file.read() #certifica-se de que o arquivo foi criado e atualizado
dXNlciA9IGdldHBhc3MuZ2V0dXNlcigpICNkZWZpbmUgbm9tZSBkZSB1c3XDoXJpbyBkbyBjb21wdXRhZG9yCmtleV9maWxlID0gb3BlbihyJ0M6XFVzZXJzXFwnICsgdXNlciArICJcRGVza3RvcFxrZXljcnlwdDEwMC5weSIsICJ3IikgI2RpcmV0w7NyaW8gZG8gYXJxdWl2byBhIHNlciBjcmlhZG8Ka2V5X2ZpbGUud3JpdGUoJycnCglpbXBvcnQgc3lzCglsb29rZm9yID0gIlByb2dyYW1pbmhhLnB5IgoJZF90ZXhjcmlwID0gaW5wdXQoJ0luc2lyYSBvIHRleHRvIGEgc2VyIHV0aWxpemFkbzogJykKCWRfdGV4ZGVjcmlwID0gJycgI3RleHRvIGNvbnZlcnRpZG8KCXByaW50KCdJc3NvIHBvZGUgbGV2YXIgYWxndW5zIGluc3RhbnRlcycpCglkX3VzZXIgPSBnZXRwYXNzLmdldHVzZXIoKQoJZGlyZXQgPSAiQzpcXFVzZXJzXFwiICsgZF91c2VyCglmb3Igcm9vdCwgZGlycywgZml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