国产探花免费观看_亚洲丰满少妇自慰呻吟_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.


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 林芝县| 环江| 乾安县| 石棉县| 高台县| 永城市| 诸城市| 通渭县| 开封市| 渭南市| 永康市| 中牟县| 桐城市| 金湖县| 镇安县| 青神县| 长岛县| 建水县| 永平县| 河西区| 庆云县| 化州市| 曲阳县| 章丘市| 甘孜县| 云林县| 方城县| 金沙县| 巴楚县| 白河县| 寿光市| 杭锦后旗| 新乡县| 大安市| 垣曲县| 北流市| 东辽县| 惠水县| 澎湖县| 怀柔区| 高安市|