Files
Python_CookBook_repo/5.文件与IO/13.获取目录内容的列表.py
2025-09-10 16:12:45 +08:00

10 lines
255 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from os import listdir
if __name__ == '__main__':
# 如果想要得到路径下所有文件的列表那么我们可以使用listdir方法
print(listdir("5.文件与IO"))
# listdir函数返回一个文件列表
print(type(listdir()))