每个人都渴望内心深处的成功,但问题是大多数人认为他们无法成功。他们不相信自己可以通过斗争获得成功。
来源:http://stackoverflow.com/questions/3806562/ways-to-move-up-and-down-the-dir-structure-in-python
#Moving up/down dir structure
print os.listdir('.') # current level
print os.listdir('..') # one level up
print os.listdir('../..') # two levels up
# more complex example:
# This will walk the file system beginning in the directory the script is run from. It
# deletes the empty directories at each level
for root, dirs, files in os.walk(os.getcwd()):
for name in dirs:
try:
os.rmdir(os.path.join(root, name))
except WindowsError:
print 'Skipping', os.path.join(root, name)
This will walk the file system beginning in the directory the script is run from. It deletes the empty directories at each level.
本文在Python中移动目录结构的方法到此结束。人生苦短,何不淡然。看透的人,处处是生机;看不透的人,处处是困境。拿得起的人,处处是担当;拿不起的人,处处是疏忽。放得下的人,处处是大道;放不下的人,处处是迷途。做什么样的人,决定权在自我;有什么样的生活,决定权也在自我。小编再次感谢大家对我们的支持!