python - 第 72 行我不理解的 Python 语法错误
问题描述
在第 72 行,我遇到了一个无效的语法错误,我和我的朋友都不确定为什么。
import random
import time
def displayIntro():
print("Welcome to hell!")
print("You may be wondering what you did to deserve this... you'll find out soon enough")
print("For the momment, you have the option to pick a path.")
print("There is path 1, which leads west through the firey lakes of damnation.")
print("Or path 2, which leads through the desert of broken glass and aids needles.")
print("There's also a 3rd path, but you don't wanna go down that one.")
do_what = raw_input("> ")
if "1" in do_what:
print("You decide to take a swim in the firey lake of damntaion.")
print("The flesh burns right off your skin and you drown in the lava of sin.")
print("You die a fast, but extremely painfull death.")
dead()
elif "2" in do_what:
print("You start to walk barefoot on the broken glass and aids needles.")
print("The desert seems to be endless though, and if the dehydration doesn't kill you, the aids eventually will.")
print("You die a slow painfull death.")
dead()
elif "3" in do_what:
print("Okay, you chose the boring path.")
print("As you walk down the empty path, you pass several doors.")
print("You have the choice of entering one of two doors.")
print("Door 1 has a 'Do not enter sign' hung on it.")
print("Door 2 has a welcome sign taped to the front")
do_what = raw_input("> ")
if "1" in do_what:
print("You walk in the room and see Hitler manscaping for Saddam Hussein.")
print("They are more embarrassed than angry.")
print("After all, it is hell, but at this point you're not sure what the torture is anymore.")
time.sleep(2)
room()
elif "2" in do_what:
print("You walk into Satans bedroom.")
print("He's laying on the bed in a sensual manner.")
print("As soon as he sees you, he becomes visibly excited.")
print("Satan ********* you to death...")
time.sleep(2)
dead()
def room():
print("Now you're just chilling - technically burning - in this room with Hitler and Saddam.")
print("You do not want to spend the rest of eternity with these two ******, so you look around the room.")
print("Eventually, you notice a pannel in the back of the room.")
print("On an ajecent wall there is a metal door.")
print("Or...you can go back the way you came.")
print("(your options are: door, pannel, or back)")
do_what = raw_input("> ")
if "pannel" in do_what:
print("You crawl into what seems like a bedroom.")
print("You look up and see Satan.")
print("He's laying on the bed in a sensual manner.")
print("As soon as he sees you, he becomes visibly excited.")
print("Satan *** ***** you to death...")
time.sleep(2)
dead()
72. elif "back" in do_what:
print("You turn around and open the door, a bunch of big *** lions jump out and mall you to death.")
dead()
elif "door" in do_what:
print("You walk through the door and are in a hazy room.")
print("As you walk farther in you notice that you're in a bank.")
print("You see yourself a little ways a way.")
print("You appear to be holding a large gun. And you seem to be pointing it at the teller.")
print("Then you hear a loud bang.")
room2()
解决方案
那是因为 raw_input() 被重命名为 input(),我只是在这里运行你的程序更改为 input() 而不是 raw_input(),它工作得很好。
使用:python --version Python 3.7.1
推荐阅读
- javascript - 快递JS | 在 JPEG 文件上设置缓存标头
- linux - 查找文件名中带有字符串的文件并解压缩
- bash - 如何编写 Bash 脚本以使用相同的命令编辑多个文本文件?
- javascript - react-native - 我们应该如何处理 file.snap
- java - 如何将数组从 TMDB 保存到 SQLite
- parsing - Bison 不会返回正确的令牌
- python - 熊猫从 CSV 和 groupby 每月总工作日读取日期
- python - 有人可以解释一下这段代码的含义吗
- ansible - 需要将json映射到list
- php - 如何查询 XML 文件以显示在 HTML 表单上搜索的结果