在python中运行子过程后继续执行下一行执行
的代码行
if __name__ == '__main__':
subprocess.run('"C:/Windows/System32/notepad.exe"')
print("hiiiiii")
以下是打开notepad.exe ,但是直到我关闭notepad.exe,print(“ hiiiiiii)才执行 就我而言,我想在打开Notepad.exe之后执行打印(“ hiiiiii”)
Below is the lines of code
if __name__ == '__main__':
subprocess.run('"C:/Windows/System32/notepad.exe"')
print("hiiiiii")
In this case notepad.exe is opened , but print("hiiiiiii) is not executed until i close notepad.exe
In my case i want to have the print("hiiiiii") to be executed after notepad.exe is opened
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
subprocess.run()
阻止主进程,popen()
而不是subprocess.run()
blocks the main process,Popen()
instead