国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

在Python中移動目錄結構的方法

2020-01-04 17:47:36
字體:
來源:轉載
供稿:網友
這篇文章主要介紹了在Python中移動目錄結構的方法,需要的朋友可以參考下
 

來源:http://stackoverflow.com/questions/3806562/ways-to-move-up-and-down-the-dir-structure-in-python

#Moving up/down dir structureprint os.listdir('.') # current levelprint os.listdir('..') # one level upprint 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.


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 扬州市| 永昌县| 卢湾区| 老河口市| 滦南县| 察哈| 文昌市| 葫芦岛市| 彝良县| 治县。| 颍上县| 长汀县| 广德县| 嘉荫县| 崇礼县| 柘荣县| 依兰县| 和顺县| 东方市| 桃园县| 潜江市| 东兰县| 灌南县| 乌审旗| 福州市| 宁乡县| 黑水县| 河北区| 盐山县| 平潭县| 灵宝市| 凤凰县| 洪雅县| 全州县| 云和县| 台北县| 福海县| 遵化市| 黄浦区| 汽车| 江西省|