例如函数应返回:
对于stackname =“ openvpn02”。
如何在配置目录中搜索“ openvpn02.json”?
答案 0 :(得分:1)
像这样
import os
to_search = "filename"
for dirpath, dirnames, filenames in os.walk("."):
for filename in [f for f in filenames if "".join(f.split(".")[:-1])==to_search]:
print os.path.join(dirpath, filename)