Advertisement
mengyuxin

meng.getFilenames.py

Jan 3rd, 2018
268
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. #! python3
  2. # getFilenames.py - Get all of the current folder.
  3. import os
  4.  
  5. for foldername, subfolders, filenames in os.walk('D:\Study'):
  6.     print('The current folder is ' + foldername)
  7.  
  8.     for subfolder in subfolders:
  9.         print('SUBFOLDER of ' + foldername + ': ' + subfolder)
  10.     for filename in filenames:
  11.         print('FILE INSIDE ' + foldername + ': ' + filename)
  12.  
  13.     print('')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement