我正在构建一个 1 小时的快速游戏,大约完成了一半,然后发生了TypeError: 'builtin_function_or_method' object is not subscriptable
错误。time.sleep[x]
我不知道为什么会这样,使用函数似乎有问题。我的完整错误和代码如下。
代码:
import time
import random
def intro():
print("You are playing a game...")
time.sleep[3]
print("of chance.")
time.sleep[1.5]
print("Enter [1] to continue.")
introChoice=''
while introChoice not in ['1']:
introChoice=input("> ")
if introChoice=="1":
tutorial()
错误:
You are playing a game...
Traceback (most recent call last):
File "/Users/jacob/Documents/a game of chance.py", line 126, in <module>
intro()
File "/Users/jacob/Documents/a game of chance.py", line 9, in intro
time.sleep[3]
TypeError: 'builtin_function_or_method' object is not subscriptable
感谢您提供任何帮助,如有必要,我愿意提供更多信息。