0
時跳過某個文件夾,這裏是我的代碼:使用os.walk
rootdir_path_without_slash = '/home/winpc/Downloads/Prageeth/backups/Final/node-wen-app'
rootdir_path_with_slash= '/home/winpc/Downloads/Prageeth/backups/Final/node-wen-app/'
dir_src = (rootdir_path_with_slash)
for subdir, dirs, files in os.walk(rootdir_path_without_slash):
for file in files:
file_name=os.path.join(subdir, file)
if file_name.endswith('.html'):
print file_name
下面這段代碼導航從給定的源目錄中的所有子目錄搜索的.html file.I需要的,如果節點模塊跳過文件夾found.Please幫我。
只要在for循環中給出條件爲if的條件爲filename =='node_modules':pass – bigbounty