python - Python如何转换WMI日期格式
问题描述
我正在使用下面的 python 代码来获取进程创建时间。但时间格式是 WMI 日期时间格式,即 20050718095318.019149-420 我想将其转换为可读格式
import wmi
from datetime import datetime
from dateutil import parser
# Initializing the wmi constructor
f = wmi.WMI()
# Printing the header for the later columns
print("pid Process name")
# Iterating through all the running processes
#for process in f.Win32_Process():
# Displaying the P_ID and P_Name of the process
#print(f"{process.ProcessId:<10} {process.Name} {PrivatePageCount}")
for process in f.Win32_Process (name="notepad.exe"):
print (process.ProcessId, process.Name,process.CreationDate)
解决方案
推荐阅读
- python - 按列对 2d numpy 字符串/浮点数组进行排序
- python - 我的 pip 显示无效版本选项错误
- java - EntityManager 没有持久性提供程序,尽管我导入了 hibernate-core 包
- java - 安卓按键设计
- typescript - 道具不改变背景按钮颜色
- node.js - 在 pm2 中获取生成节点 ENOENT
- javascript - 在 puppeteer(Nodejs 库)中发送 postMessage
- python - 使用边界框从图像中裁剪人脸
- python - 如何将 pandas df 与 geopandas df 合并以在 shapefile 上绘图
- javascript - Promise.allSettled() 响应的类型错误