python如何将选定目录下的一级子目录名称提取出来,并将子目录的子目录也就是二级子目录的名称也提取出来,导出为txt文本
1. Python需求的任务
_
python如何将选定目录下的一级子目录名称提取出来,并将子目录的子目录也就是二级子目录的名称也提取出来,导出为txt文本 </font
我要将该目录中的所有文件名称导出来,二级名称也导出
导出的md代码如下:
- **000-Extract-photo from word**
* Extract-photo from word.py
* photo
* photo.docx
* subdirectories.txt
* tempCodeRunnerFile.py
- **001-Export photo from word**
* image
* photo_word.py
* subdirectories.txt
* tempCodeRunnerFile.py
* 数字图像处理.docx
- **002-copyfile**
* copyfile.py
* copyfileA_toB.py
* file
* Image-0.png
* Image-1.png
* Image-2.png
* Image-3.png
* Image-4.png
* Image-5.png
* subdirectories.txt
- **003-copyfileto-alldictory**
* copy3.py
* dir
* read_filename.py
* subdirectories.txt
* tempCodeRunnerFile.py
* template.png
- **004-translate**
* OIP-C.jpg
* subdirectories.txt
* translate.py
- **005-convert_music**
* mp3
* mp3_to_wav.py
* subdirectories.txt
* tempCodeRunnerFile.py
* wav
- **006-get_path**
* getpath.py
* mp3
* subdirectories.txt
* tempCodeRunnerFile.py
- **007-grab_bili**
* grab_video.py
* subdirectories.txt
- **008-Clear_thefolder**
* clear-folder.py
* frv
* subdirectories.txt
* tempCodeRunnerFile.py
- **009-Create fixed .xx file**
* creat-.xx-file.py
* subdirectories.txt
- **010-Slide photo to small**
* Excel文件售卖.png
* slidephoto.py
* subdirectories.txt
- **011-grab_work**
* subdirectories.txt
* work.py
- **012-Creat_000~999_fix.xxfile**
* 0000.py
* subdirectories.txt
* template.py
- **013-Convert-video-to-mp3**
* convert_mp4to3.py
* subdirectories.txt
- **014-copytexttofile**
* copyfile.py
* subdirectories.txt
- **015-sendphototoevery-dictory**
* send-photo.py
* subdirectories.txt
- **016-Components-photoandmp3**
* composepho