本文介绍了Python解释器Jython - 模块的执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下是该问题的链接:
Here's the link to the problem:Python Interpreter in Jython
以下是一个潜在的解决方案:
interp.exec("import os.path.abspath(__file__)/printTwice.py)");
interp.exec("printTwice.print_twice('Adam')");
但是它返回了一个错误:
这返回了以下错误:线程main中的异常SyntaxError :(mismatched input('expecting NEWLINE',('',1,22,'import os.path.abspath(file) /printTwice.py)\\\
'))
This returned the following error: Exception in thread "main" SyntaxError: ("mismatched input '(' expecting NEWLINE", ('', 1, 22, 'import os.path.abspath(file)/printTwice.py)\n'))
推荐答案
interp.exec("import printTwice");
interp.exec("printTwice.print_twice('Adam')");
这应该有效。
这篇关于Python解释器Jython - 模块的执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!