Discuss / Python / 先熟悉一下吧

先熟悉一下吧

Topic source

GOGOGO-枼子

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

import os

def findfile(path): for x in os.listdir(path): if os.path.isfile(x) and os.path.splitext(x)[1] == '.docx': print(x) elif os.path.isdir(x): d = os.path.join(path, x) findfile(d)

test = os.path.abspath('.') findfile(test)


  • 1

Reply