#- * -コーディング:UTF-8 - * - #1 著者:宝山 インポートのOS のdirname = R ' D:\ 0.shenma 2017年鑑\ 02聊城年鑑データ\ 01データ\ 01聊城データ\ ... ' ファイル名 = " * .XLS " 結果 = [] DEF検索(dirnameは= dirnameは、ファイル名= "" ): 用のアイテムの中os.listdir(dirnameは): item_pathは = os.path.join(dirnameは、項目) IF os.path.isdirは( item_path): 検索(item_path、ファイル名) ELIFのos.path.isfile(item_path): IFファイル名の中のアイテム: グローバル結果 result.append(item_path + " ; " ) プリント(item_path + " ; " ) であれば __name__ == ' __main__ ' : 検索(dirnameは、ファイル名)
転送:https://www.cnblogs.com/hyacinthwyd/p/8997917.html
ありがとうございます!