Python 获取文件夹以及子文件内所有文件名

# _*_ coding: utf-8 _*_
# @Author :GengYu
# @Create_time :2020/4/23 7:02
# @Email :[email protected]
# @File_name :getName.py
import os
list_name = []
for i in os.walk(os.getcwd()):
    for n in i[2]:
        list_name.append(n)
str = ','
print(str.join(list_name))

 

 

# _*_ coding: utf-8 _*_
# @Author :GengYu
# @Create_time :2020/4/23 7:02
# @Email :[email protected]
# @File_name :getName.py
# @Software :PyCharm
import os
list_name = []
for i in os.walk(os.getcwd()):
    for n in i[2]:
        list_name.append(n)
str = ','
print(str.join(list_name))
 

你可能感兴趣的:(学习之路)