Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

Administrator / lesson7_2

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Members
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Switch branch/tag
  • lesson7_2
  • diy2.py
Find file
BlameHistoryPermalink
  • BellCodeEditor's avatar
    auto save · 9a625bda
    BellCodeEditor committed 3 years ago
    9a625bda
diy2.py 681 Bytes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
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)