python os一些相关操作
1 import os
2 path = os.path.join(os.path.expanduser("~"),"a.log")
3 filepath, filename = os.path.split(path)
4 a,b = os.path.splitext(filename)
5 print a,b
6 for fname in os.listdir("/root/Desktop"):
7 #if os.path.isfile(os.path.join("/root/Desktop",fname)):
8 if os.path.isdir(os.path.join("/root/Desktop",fname)):
9 print fname