为什么不使用 .lower() 或 .upper() 命令输入 return 打印值?

Why doesn't input return a the print value with .lower() or .upper() commands?

当我 运行 代码时,我的 python 无法识别我输入的内容,无论是 .lower 还是 .upper,这是为什么?

import sys

Good = input('Am i Good? > ').upper()
if Good == 'no':
print(True, 'You are good')
elif Good == 'no':
print(True, ' You are still good')
elif Good == 'quit':
sys.exit()

在这行代码中:

Good = input('Am i Good? > ').upper()

您将输入转换为大写,然后将字符串与小写字符串进行比较("no""quit")。这永远不会匹配,因为 "NO""no" 是不同的字符串(Python 在比较字符串时关心大小写)。