# -*- conding: utf-8 -*-
def search_file(keyword):
import os
# get ./
pwd = os.getcwd()
# file walk
x = os.walk(pwd)
# walk file
for a, b, c in x:
for i in c:
if keyword in i:
key_path = os.path.join(a, i)
print(' file get || abspath : %s' %(key_path))
search_file('py')
Sign in to make a reply
来自cx301-5星系
# -*- conding: utf-8 -*-
def search_file(keyword):
import os
# get ./
pwd = os.getcwd()
# file walk
x = os.walk(pwd)
# walk file
for a, b, c in x:
for i in c:
if keyword in i:
key_path = os.path.join(a, i)
print(' file get || abspath : %s' %(key_path))
search_file('py')