I am a beginner at Python. Below is the testing code for Python's command line args. If executing from command line with different parameter formats, I get different results, but it feels strange, can anyone help me understand why?
1, $test.py d:\ --> this seems ok for os.walk call
2, $test.py 'd:\' --> this will cause nothing output
BTW: I used Python 2.7.3
Test code:
import os
import sys
if __name__ == '__main__':
argMock = 'D:\\'
path = len(sys.argv) > 1 and sys.argv[1] or argMock
for root, dirs, files in os.walk(path):
for name in files:
print name