【发布时间】:2015-12-10 21:23:19
【问题描述】:
我正在尝试在 Python 3 (IDLE) 中编写一个程序,该程序允许用户输入引号并以大写、小写和反向输出。我试过这个:
quote = input("Enter your quote here: ")
print(quote.upper())
print(quote.lower())
print(quote.reverse())
...但是当我测试它时我得到的只是这个错误文本:
Enter your quote here: You are always unique.
Traceback (most recent call last):
File "C:\Users\shobha m nair\Documents\Quote Conversion.py", line 2, in <module>
quote = input("Enter your quote here: ")
File "<string>", line 1
You are always unique.
^
SyntaxError: invalid syntax
【问题讨论】:
-
您正在使用 Python 2,其中
input在结果上运行eval。 -
您正在寻找
raw_input。
标签: python reverse uppercase lowercase