Discuss / Python / 人太笨,卡了3天时间终于可以交作业了

人太笨,卡了3天时间终于可以交作业了

Topic source

开心Ikos

#1 Created at ... [Delete] [Delete and Lock User]

import os

key=input("please enter what you want to search:\n") path=input("please enter where do you want to search:\n")

def aa(path,key): for x in os.listdir(path): pf=os.path.join(path,x) if os.path.isfile(pf): if key in x: print(pf)

    elif os.path.isdir(pf):
        aa(pf,key)

aa(path,key)

参考了同学的代码,实现指定路径的查找功能

丁磊BLH

#2 Created at ... [Delete] [Delete and Lock User]

同学,好奇怪,我这跟你差不多的代码但是好像目录太深了就没法输出了

在此插入代码
在此插入代码

  • 1

Reply