while (0 > ship_row_1_1 or ship_row_1_1 > 9) or (0 > ship_row_1_2 or ship_row_1_2 > 9)\n
or(0 > ship_col_1_1 or ship_col_1_1 > 9) or (0 > ship_col_1_2 or ship_col_1_2 > 9):
Run Code Online (Sandbox Code Playgroud)
我正在使用python 2.7.6并遇到了一个我不确定的错误.这条线很长,我不得不侧滚动查看结束,所以我尝试添加'\n',我认为这将让我继续下一行的代码.问题是我收到错误:"你的程序出错了:行继续字符后的意外字符"
'\n'之后没有空格或任何东西,所以我不确定为什么我会收到这个错误.
我是初学者,所以任何帮助都会受到赞赏并提前感谢
你只需添加一个\而不是\n如下:
def say_hi():
while True\
and 1==1\
and 2==2:
print 'hello'
Run Code Online (Sandbox Code Playgroud)
while (0 > ship_row_1_1 or ship_row_1_1 > 9) or (0 > ship_row_1_2 or ship_row_1_2 > 9)\
or(0 > ship_col_1_1 or ship_col_1_1 > 9) or (0 > ship_col_1_2 or ship_col_1_2 > 9):
Run Code Online (Sandbox Code Playgroud)