教科书本身显示双引号,但当我尝试时它给出了 SyntaxError
Textbook is showing a double quote by itself but when I try it gives a SyntaxError
这本书已经两次展示给我 "
自己使用了。
def chooseCave():
cave = "
while cave != '1' and cave != '2':
print('Which cave will you go into?(Enter 1 or 2)')
cave = input()
我在扫描字符串文字时收到 SyntaxError: EOL
我不确定用什么来代替单个 "
来实现我想要的。
我觉得你有点看错了这本书。
您会注意到他们在整个示例的其余部分都使用单引号来标记字符串。我怀疑这个的第一次使用没有什么不同。
例子其实是;
def chooseCave():
cave = ''
while cave != '1' and cave != '2':
print('Which cave will you go into?(Enter 1 or 2)')
cave = input()
这本书已经两次展示给我 "
自己使用了。
def chooseCave():
cave = "
while cave != '1' and cave != '2':
print('Which cave will you go into?(Enter 1 or 2)')
cave = input()
我在扫描字符串文字时收到 SyntaxError: EOL
我不确定用什么来代替单个 "
来实现我想要的。
我觉得你有点看错了这本书。
您会注意到他们在整个示例的其余部分都使用单引号来标记字符串。我怀疑这个的第一次使用没有什么不同。
例子其实是;
def chooseCave():
cave = ''
while cave != '1' and cave != '2':
print('Which cave will you go into?(Enter 1 or 2)')
cave = input()