为了账号安全,请及时绑定邮箱和手机立即绑定

如何将数字列表转换为字母列表,Python

如何将数字列表转换为字母列表,Python

开心每一天1111 2021-06-10 14:44:53
python 新手,我正在尝试编码加密消息字母表改写如下:cipher = [ "q", "a", "z", "w", "s", "x", "e", "d", "c", "r", "f", "v", "t", "g", "b", "y", "h", "n", "u", "j", "m", "i", "k", "o", "l", "p"]idx = ord ("d") - ord ("a")print(cipher[3])输出:winput = str(input('Write Text: ')) #hello world used hereinput = input.lower()output = []for character in input:    number = ord(character) - 97    output.append(number)print(output)输出:[7, 4, 11, 11, 14, -65, 22, 14, 17, 11, 3]不知道这两个怎么对应...我试过了:print(cipher[output])返回类型错误:列表索引必须是整数或切片,而不是列表
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 121 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信