From 33b3b334106d8897d8b9370986d7cc1539892390 Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Thu, 8 Jul 2021 17:15:56 +0800 Subject: [PATCH] auto save --- diy2.py | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/diy2.py b/diy2.py index 2bc971e..083fe69 100644 --- a/diy2.py +++ b/diy2.py @@ -1,4 +1,36 @@ +import random message = "诺依,周末一起去看动漫展吧!" +key = input('请输入加密语句:') +#干扰字符 +key_mes = input('请输出干扰字符:') + +text = '' +for i in message: + str1 = random.choice(key) + str2 = random.choice(key) + text = text + i + str1 + str2 +#字符串转成列表 +text1 = list(text) +a = random.randint(0,len(text1)-1) +text1.insert(a,key_mes) +#列表转成字符串 +str = ''.join(text1) +print(str) + + + + + +''' # 请对message进行遍历,取出所有元素 +for i in message: + print(i) + +#通过索引取 +i = 0 +while i <= len(message)-1: + print(message[i]) + i+=1 +''' \ No newline at end of file -- libgit2 0.25.0