1.判斷文件是否存在:os.path.exists(r"c://python//hello.py")--->true/false
2.判斷是否是絕對(duì)路徑:os.path.isabs(r"c://python//hello.py")
3.判斷是否是目錄:os.path.isdir(dirpath)
4.判斷是否是文件:os.path.isfile(filepath)
5.判斷是否是鏈接文件:os.path.islink(linkpath)
6.獲取文件大小:os.path.getsize(filename)
7.搜索目錄下的所有文件:os.path.walk()
8.文件的訪問時(shí)間:os.path.getatime() #這里的時(shí)間以秒為單位,并且從1970年1月1日開始算起
9.文件的修改時(shí)間:os.path.getmtime(myfile)
10.復(fù)制單個(gè)文件:shultil.copy(oldfile,newfile)
11.復(fù)制整個(gè)目錄樹:shultil.copytree(r".\setup",r".\backup")
12.刪除整個(gè)目錄樹:shultil.rmtree(r".\backup")
13.創(chuàng)建一個(gè)唯一的臨時(shí)文件:tempfile.mktemp()--->filename
14.打開臨時(shí)文件:tempfile.T