python 搜索路径 包含子目录么
2017-04-19
展开全部
#!/usr/bin/env python
#-*- encoding: utf-8 -*-
from sys import stdin
from os import walk
from os.path import join
name = stdin.readline().rstrip()
for root, dirs, files in walk('/'):
if name in dirs or name in files:
print(join(root, name))
#-*- encoding: utf-8 -*-
from sys import stdin
from os import walk
from os.path import join
name = stdin.readline().rstrip()
for root, dirs, files in walk('/'):
if name in dirs or name in files:
print(join(root, name))
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询