Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
def encrypt_message(text, x): text = list(text) for y in text: ord(text)
返回 ord() 预期长度为 1 的字符串,但找到列表
问题是你传递了你需要传递的textto函数。ordy
text
ord
y
但是由于字符串是可迭代的对象,您可以循环遍历您的字符串:
def encrypt_message(text, x): return [ord(i) for i in text]