私信  •  关注

Michael Schneider

Michael Schneider 最近创建的主题
Michael Schneider 最近回复了
14 年前
回复了 Michael Schneider 创建的主题 » 如何在PyCharm中按顺序运行代码?

如果你想要测试1。py将保持可执行,其功能与调用内部服务时相同。py,然后做一些类似的事情:

测试1。py

def main():
    print "I am a test"
    print "see! I do nothing productive."

if __name__ == "__main__":
    main()

服务py

import test1
# lots of stuff here
test1.main() # do whatever is in test1.py