语法:os.list(path) 参数:path--需要列出目录的路径 返回值:返回指定路径下的文件和文件夹列表
import os
# 打开文件
path = os.getcwd() # 返回当前工作目录
dirs = os.listdir( path )
# 输出所有文件和文件夹
for file in dirs:
print (file)
语法:os.list(path) 参数:path--需要列出目录的路径 返回值:返回指定路径下的文件和文件夹列表
import os
# 打开文件
path = os.getcwd() # 返回当前工作目录
dirs = os.listdir( path )
# 输出所有文件和文件夹
for file in dirs:
print (file)