Files
Random-Picker/b64writer.py

30 lines
1.1 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import base64
def encode(str):
return base64.b64encode(bytes(str,"utf-8"))
def main():
flag = True
while flag:
id = input("输入需要更改的id:")
method = input("输入需要进行的操作:('-'代表加入概率减少人员组,'+'代表加入概率增加人员组,'0'代表删除该人员)")
command = ""
if method == "-" or method == "——":
command = id + ",-"
elif method == "+":
command = id + ",+"
elif method == "0":
command = id + ",0"
else:
print("指令语法错误,请检查输入指令是否满足要求")
continue
print("密文已生成:" + encode(command).decode("utf-8"))
with open("config.data",mode = "a",encoding="utf-8") as config:
config.write(encode(command).decode("utf-8") + "\n")
print("密文已写入./config.data文件中")
command = input("是否继续录入?(Y/N)")
if not (command == "Y" or command == "y"):
flag = False
if __name__ == "__main__":
main()