while True : |
words = input ( '请输入要编码的内容:' ) |
ans = int ( input ( '请输入偏移量:' )) |
if (words = = 'break' ) or (ans = = 'break' ): |
break |
code = [] |
for w in words: |
num = ord (w) |
code.append(num) |
num = num + ans |
print (code) |
f = open ( '1.txt' , 'w' ) |
res = str (code) |
f.write(res) |
f.close() |
print ( '编码结果已写入文件!' ) |
中级程序员
by: hmlhmlhml3 发表于:2021-01-27 10:11:35 顶(0) | 踩(0) 回复
有bug.当输入break,还是要接着输入偏移量才能推出。我调整了下。你看看。
回复评论