J
Jerry Fleming
Hi,
I wrote a python script to list files in a directory but somehow did it
wrongly by importing os.path instead of os. To my astonishment, it works
just as charm:
#!/usr/bin/python
import os.path
for file in os.listdir('/root/'):
print file
I was wondering why? os.path doesn't contain listdir, why there is no
complaint like 'os: unknown name'? Does this mean, instead of importing
os, we can import os.path?
Thanks.
I wrote a python script to list files in a directory but somehow did it
wrongly by importing os.path instead of os. To my astonishment, it works
just as charm:
#!/usr/bin/python
import os.path
for file in os.listdir('/root/'):
print file
I was wondering why? os.path doesn't contain listdir, why there is no
complaint like 'os: unknown name'? Does this mean, instead of importing
os, we can import os.path?
Thanks.