【发布时间】:2020-08-24 22:35:50
【问题描述】:
我正在使用 Threading 搜索文件:
import threading
def thread(seconds):
for root, dirs, files in os.walk('/'):
for file in files:
if file == 'Viber.exe':
viber = os.path.join(root, file)
print(viber)
print("Finish")
threading.Thread(target = thread, args = (1,), daemon = True).start()
然后我需要打开那条路径:
import subprocess
subprocess.check_output(viber, shell=True)
但我遇到了错误:
NameError: name 'viber' is not defined
我不知道该怎么做,以及如何解决它(((请有人帮忙!
【问题讨论】:
标签: python variables subprocess python-multithreading