我不知道为什么这个幸福的EOL应该是这样的:\
Traceback (most recent call last):
File "tester.py", line 37, in <module>
main(sys.argv)
File "tester.py", line 19, in main
test_manager1.run_tests()
File "/a/fr-05/vol/home/stud/dreifuss/Desktop/python/ex2/test_manager.py", line 21, in run_tests
self.lines_list[lineId].run_tests()
File "/a/fr-05/vol/home/stud/dreifuss/Desktop/python/ex2/test.py", line 29, in run_tests
myRes = eval(self.line, d)
File "<string>", line 1
"".join([x.group('eyal') for x in __import__('re').finditer(r'(^
^
SyntaxError: EOL while scanning string literal
答案 0 :(得分:1)
这很简单:你有一个不在给定行内结束的字符串文字。
要么在该行内结束,要么使用三重引号,例如
"".join([x.group('eyal') for x in __import__('re').finditer(r'''(^
something
''')])
答案 1 :(得分:0)
如果您想以这种方式使用换行符,请将单引号更改为下面一行的三引号。
"".join([x.group('eyal') for x in __import__('re').finditer(r'(^