import os allfiles = [] def getAllFiles(path,level): childFiles = os.listdir(path) for file in childFiles: filepath = os.path.join(path,file) if os.path.isdir(filepath): getAllFiles(filepath,level+1) allfiles.append('\t'* level + filepath) getAllFiles('movie',0) for f in reversed(allfiles): print(f)
老师,这些代码我实在是理解不了,能给详细解释一下吗?level起到什么作用?listdir又起到什么作用?path表示的是什么?
老师,这里目录的递归只能支持英文格式么,中文格式说系统找不到指定路径
C:\Users\lenovo\PycharmProjects\pythonProject1\venv\Scripts\python.exe C:/Users/lenovo/PycharmProjects/pythonProject1/01.py
pygame 2.0.1 (SDL 2.0.14, Python 3.7.7)
Hello from the pygame community. https://www.pygame.org/contribute.html
Process finished with exit code -805306369 (0xCFFFFFFF)
老师我这个一运行屏幕没有东西,然后关闭就出现这样的,是什么原因啊
老师这错误我解决不了,我开头已经加了encoding=utf-8了
还是不行
老师,这个<Button-1>有什么含义
event用来干嘛??
我选择的文件不是我这个程序工作的文件夹内,下面那两个打印为什么是False?
print(os.path.isdir("D:/e.txt"))
为什么是False ,难道这个不是目录吗,这不是目录,什么是目录呢
老师,这我应该怎么改了。看下面同学是编码不统一吗?我这全部都是utf-8啊
老师,这是怎么回事,我感觉没有什么问题啊
老师麻烦看看什么原因?我试了好多次。。。
D:\pycharm\venv\Scripts\python.exe D:/pycharm/GUI/my01.py
File "D:/pycharm/GUI/my01.py", line 3
SyntaxError: Non-UTF-8 code starting with '\xb5' in file D:/pycharm/GUI/my01.py on line 3, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
Process finished with exit code 1
老师,这是什么情况啊,我去调了file Encodeing 没用
老师,我upload为啥会报这个错误??
老师,这个是怎么回事,cmd里面显示我成功安装了pygame啊
老师,这个错在哪里,我去掉前面的..就对,加上就不对
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637