Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
adasegroup
GitHub Repository: adasegroup/NEUROML2022
Path: blob/main/seminar4/utils.py
108 views
1
import os
2
3
def list_files(startpath):
4
for root, dirs, files in os.walk(startpath):
5
level = root.replace(startpath, '').count(os.sep)
6
indent = ' ' * 4 * (level)
7
print('{}{}/'.format(indent, os.path.basename(root)))
8
subindent = ' ' * 4 * (level + 1)
9
for f in files:
10
print('{}{}'.format(subindent, f))
11