任何人都可以告诉我我的程序有什么问题??? 当我运行这个程序时,我面对"语法错误意外字符后续行字符":
f = open(D\\python\\HW\\2_1 - Copy.cp,"r");
lines = f.readlines();
for i in lines:
thisline = i.split(" ");
Run Code Online (Sandbox Code Playgroud)
unw*_*ind 11
你需要引用那个文件名:
f = open("D\\python\\HW\\2_1 - Copy.cp", "r")
Run Code Online (Sandbox Code Playgroud)
否则D之后的反斜杠被解释为行继续符,并且后面应该跟一个换行符.这用于在多行上扩展长表达式,以提高可读性:
print "This is a long",\
"line of text",\
"that I'm printing."
Run Code Online (Sandbox Code Playgroud)
此外,您不应该;在Python语句的末尾使用分号().