diy2.py
681 Bytes
message = input("请输入要加密的语句:")
#for i in message:
# length = len(message) #获取列表长度
# i = 0 #i作为索引值,默认从0开始
# while i < length:
# a = message[i]
# print(a)
# i += 1
key = "SDFGHJKL看了你的拉发哦i事件发酵哦怕萨跑哦是否"
#加密后的语句
key_message = ""
noise = "@#$%^&*()_(*&*(&$"
import random #导入随机模块
for i in message:
str1 = i #空执行语句
str2 = random.choice(key)
str3 = random.choice(key)
key_message += (str1 + str2 + str3)
list_m = list(key_message)
index = random.randint(0,len(list_m))
list_m.insert(index,noise)
list_m = "".join(list_m)
print(list_m)