Python 3.x 属性错误:';列表';对象没有属性';翻译';

Python 3.x 属性错误:';列表';对象没有属性';翻译';,python-3.x,Python 3.x,我是编程新手,我遇到了以下错误: 回溯(最近一次呼叫最后一次): 文件“”,第1行,在 atbash_加密列表(['hello'、'debye'、'huh'、'later') 文件“/Users/sebastiandemian/Desktop/School/CSC 241/atbash_-cypher.py”,第8行,在atbash_-encrypt_列表中 返回atbash_加密(lst) 文件“/Users/sebastiandemian/Desktop/School/CSC 241/atb

我是编程新手,我遇到了以下错误:

回溯(最近一次呼叫最后一次): 文件“”,第1行,在 atbash_加密列表(['hello'、'debye'、'huh'、'later') 文件“/Users/sebastiandemian/Desktop/School/CSC 241/atbash_-cypher.py”,第8行,在atbash_-encrypt_列表中 返回atbash_加密(lst) 文件“/Users/sebastiandemian/Desktop/School/CSC 241/atbash_-cypher.py”,第5行,在atbash_-encrypt中 返回s.translate(移位表) AttributeError:“list”对象没有属性“translate”

def atbash_加密: 字母表='abcdefghijklmnopqrstuvxyz' 移位字母表='ZYXWVUTSRQPONLKJIHGFEDCBA' 移位表=str.maketrans(字母表,移位表) 返回s.translate(移位表)

def atbash_加密_列表(lst): 返回atbash_加密(lst)


谁能给我一个提示,说明我在哪里犯了错误吗?

您将一个列表传递给了
atbash\u encrypt\u list
,该列表直接传递给
atbash\u encrypt
。您是否打算在元素上循环(例如
返回映射(atbash\u encrypt,lst)