我可以做这样的事情吗(实际上它不起作用)
flist = [dirpath + f for f for fnames for dirpath, dirnames, fnames in os.walk('/home/user')]
谢谢!
最佳答案
fnames
尚不存在。交换循环。
flist = [dirpath + f for dirpath, dirnames, fnames in os.walk('/home/user') for f in fnames]
关于python - 在 python 中使用列表理解获取完整路径名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6278369/