Python_报错:SyntaxError: EOL while scanning string literal
原因:python中,目录操作时,字符串的最后一个字符是斜杠,会导致出错,去掉即可
上代码
>>> import os
>>> os.chdir(r"e:")#字符串的最后一个字符是斜杠,会导致出错
File "<stdin>", line 1
os.chdir(r"e:")
^
SyntaxError: EOL while scanning string literal
解决方法:去掉最后的即可
>>> import os >>> os.chdir(r"e:") >>>
