Commit a6fe249f by BellCodeEditor

auto save

parent 027d3568
Showing with 33 additions and 0 deletions
message = "诺依,周末一起去看动漫展吧!" message = "诺依,周末一起去看动漫展吧!"
#干扰字符
# 请对message进行遍历,取出所有元素 # 请对message进行遍历,取出所有元素
# for i in message:
# print(i)
# # 如何通过索引便利
# i = 0
# while i < len(message):
# print(message[i])
# i += 1 # i = i + 1 , i -= 1 , i *= 1 , i /= 1
import random #导入模块
message = "诺依,周末一起去看动漫展吧!"
#干扰字符
key = '啊是的服务人群而退哦iui于太原人忒热尔头晕头痛!$%^&*(&^%TREdsdFDGHTYU&86q34rwfgstytui)'
#添加新的干扰字符:
new_key = '!@#$%^'
text = '' #创建空字符串
for i in message: #便利字符串
str1 = random.choice(key) #随机从字符串中取出元素
str2 = random.choice(key)
text = text+str1+str2+i #把随机取出来的字符串与我们遍历的语句进行拼接
#列表里面的方法 列表名.insert(索引,元素)
#把字符串转成列表
list1 = list(text)
num = random.randint(0,len(list1)) #生成一个随机数
list1.insert(num,new_key)
#把列表转成字符串
str = ''.join(list1)
print(str)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment