ARTICLE DETAIL

建站实战干货

来自一线的建站与推广经验沉淀,每一条都经过真实交付验证。

View root,dirs,files

2026/8/9 0:33:03 拓冰建站 浏览量
View root,dirs,files

View root,dirs,files

Referring to os src which location of /lib/python3.12

Code:
import os
For root,dirs,files in os.walk("../tmp2"):
print('\n %s %s %s' %(root,dirs,files))

results of console:
emit here

notice for parameters to os.walk function:

if pars is wrong or equal to empty, the walk function may don't work, nothing shows on console.
"." represent current directory
".." represent parents directory