Oh Snap!

Please turnoff your ad blocking mode for viewing your site content

Hit enter after type your search item

Python 3 Script to Restart the Computer or PC using OS Module Full Project For Beginners

/
/
/
14 Views

 

Welcome folks today in this blog post we will be restarting the computer or pc using os module in python. All the full source code of the application is shown below.

 

 

Get Started

 

 

In order to get started you need to create an app.py file and copy paste the following code

 

app.py

 

import os 

restart = input("Do you wish to restart your computer ? (yes / no): ") 

if restart == 'no': 
    exit() 
else: 
    os.system("shutdown /r /t 1")

 

Now if you execute the above script by typing the below command as shown below

READ  Python 3 Script to Write Excel File Using xlwt Module Full Project For Beginners

 

python app.py

 

After executing this script your computer or pc will automatically shuts down and will be restarted

Leave a Comment

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

This div height required for enabling the sticky sidebar
Coding Shiksha 2020. All Rights Reserved.
Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views : Ad Clicks : Ad Views :