![](/img/trans.png)
[英]How do I zip the contents of a folder using python (version 2.5)?
[英]How do I read the contents of Windows History (folder) using python?
我想使用python讀取“C:\\ Users \\ user \\ AppData \\ Local \\ Microsoft \\ Windows \\ History”的內容。 我嘗試了os.listdir
,但它只返回了“History.IE5”和“Low”。 如何讀取其中所有項目的名稱並可能刪除它們?
你需要os.walk
import os
for root, dirs, files in os.walk('path\\to\\folder'):
print(root)
print(dirs)
print(files)
for file in files:
os.remove(file)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.