import os
from os.path import isfile, join
def walk(dir, dir_list=[]):
for name in os.listdir(dir):
path = join(dir, name)
if isfile(path):
dir_list += [path]
else:
walk(path, dir_list)
return dir_list
aW1wb3J0IG9zCmZyb20gb3MucGF0aCBpbXBvcnQgaXNmaWxlLCBqb2luCgpkZWYgd2FsayhkaXIsIGRpcl9saXN0PVtdKToKCWZvciBuYW1lIGluIG9zLmxpc3RkaXIoZGlyKToKCQlwYXRoID0gam9pbihkaXIsIG5hbWUpCgkJaWYgaXNmaWxlKHBhdGgpOgoJCQlkaXJfbGlzdCArPSBbcGF0aF0KCQllbHNlOgoJCQl3YWxrKHBhdGgsIGRpcl9saXN0KQoJcmV0dXJuIGRpcl9saXN0