私信  •  关注

Faraaz Kurawle

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

根据给定的示例,这是最好的方法:

# test1.py

def foo():
    print("hellow")
# test2.py
from test1 import foo # might be different if in different folder.
foo()

但根据标题,使用 os.startfile("path") 这是最好的方法,因为它很小,而且很有效。这将执行指定的文件。我的python版本是3。x+。