Discuss / Python / 小工具

小工具

Topic source

# -*- 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')


  • 1

Reply