标签:io os for 文件 sp div on cti ef
#!/usr/bin/python
import
os
import
string
def
get_name(path_name, file_str):
dir_name
=
[]
dir_name
=
os.listdir(path_name)
for
i
in
range
(
0
,
len
(dir_name)):
curdir
=
os.path.join(path_name, dir_name[i])
if
os.path.isdir(curdir):
if
file_str
in
dir_name[i]:
print
‘DIR:‘
+
curdir
get_name(curdir, file_str)
else
:
if
file_str
in
dir_name[i]:
print
‘FILE:‘
+
curdir
file_name
=
raw_input
(
"Input file name:"
)
path
=
raw_input
(
"Input path:"
)
get_name(path, file_name)
标签:io os for 文件 sp div on cti ef
原文地址:http://www.cnblogs.com/L-H-R-X-hehe/p/4025281.html