python - 如何使“if input ==”条件

时间:2013-11-29 19:14:28

标签: python python-3.x

我正在尝试将我的游戏组织成一种玩python的方式。到目前为止,这是我的代码:

Skyrim = "Skyrim"
GTAIV = "GTAIV"
GTASA = "GTASA"
Games = Skyrim + " " + GTAIV + " " + GTASA

这就是现在的字面意思。基本上我要问的是我如何制作一个相当于“If input == this”

的条件

1 个答案:

答案 0 :(得分:4)

真的非常简单:

Skyrim = "Skyrim"
GTAIV = "Skyrim"
GTASA = "Skyrim"
Games = Skyrim + " " + GTAIV + " " + GTASA

if raw_input("Enter: ") == "Games":
    print Games

输出:

Enter: Games
Skyrim Skyrim Skyrim