Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
import psutil p = psutil.Process(7055) >>> p.create_time 1267551141.5019531
如何将此时间转换为日期时间对象,以便我可以在分钟内找到此时间和今天时间(current_time = datetime.datetime.today)之间的差异?
你不需要一个日期时间来得到它。 time.time提供当前时间,以自纪元以来的秒数表示。将其除以 60 得到经过的分钟数:
time.time
>>> import time >>> (time.time() - psutil.Process(1).create_time) / 60 20957.253114116193