How can i use a counter inside the recursive function? This code gives me the error 'local variable 'c' referenced before assignment'
#!/usr/bin/python from os import listdir from os.path import isdir,join,basename import HTMLgen dirpath = '/devel/python/html/test' COUNTER = 0 def rec(f): res = [] COUNTER += 1 for ele in listdir(f): res.append(ele) ele = join(f,ele) if isdir(ele): res.append(rec(ele)) return res print HTMLgen.List(rec(dirpath)) -- http://mail.python.org/mailman/listinfo/python-list