1 import os 2 def print_directory(sPath): 3 for sChild in os.listdir(sPath): 4 sChildPath = os.path.join(sPath,sChild) 5 print ‘a‘,sChildPath 6 if os.path.isdir(sChildPath): 7 print_directory(sChildPath) 8 else: 9 print sChildPath 10 11 z = os.path.abspath(‘.‘) 12 y = os.path.join(z,‘flasky13‘) 13 print_directory(y) 14 print os.listdir(z)
原文:http://www.cnblogs.com/qqzj/p/6666331.html