E
epost2
Can someone explain to me the output of this simple script? I wonder
why ['test1.txt'] is printed before "files in c:\", and also why None
shows up?
________________
in file test.py:
def main():
print "files in c:\ :%s" % ListFiles("c:\")
def ListFiles(path):
for root,dirs,files in os.walk(path):
print files
if __name__ == "__main__":
main():
________________
output:
C:\> python test.py
['test1.txt']
files in c:\ :None
why ['test1.txt'] is printed before "files in c:\", and also why None
shows up?
________________
in file test.py:
def main():
print "files in c:\ :%s" % ListFiles("c:\")
def ListFiles(path):
for root,dirs,files in os.walk(path):
print files
if __name__ == "__main__":
main():
________________
output:
C:\> python test.py
['test1.txt']
files in c:\ :None