python

Python 3 Script to Check PC or Laptop OS Last Reboot Time Using psutil Library Full Project For Beginners


 

 

In order to get started you need to install the library using the pip command as shown below

 

 

pip install psutil

 

 

After installing this library you need to make an app.py file and copy paste the following code

 

 

app.py

 

 

import psutil
import datetime

# returns the time in seconds since the epoch
last_reboot = psutil.boot_time()

# coverting the date and time in readable format
print(datetime.datetime.fromtimestamp(last_reboot))

Similar Posts:

    None Found

Leave a Reply

Your email address will not be published. Required fields are marked *