簡體   English   中英

如何使用python讀取Windows歷史記錄(文件夾)的內容?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM