dimanche 7 janvier 2018

How to use If statments off of a terminal output in Python 3 [duplicate]

This question already has an answer here:

So i know that knowing what to google is half the battle but im not able to really find the answer to my question. All i want to be able to do is run a linux command like:

ufw enable

Output is somthing like

Status is active

I want to create a python script to run this command and if the output is "Status is active" then print "It is enabled" and if else: print "It is not enabled"

But im not sure how to go about that if you could help me out i would greatly appreciate it thank you in advanced.

Aucun commentaire:

Enregistrer un commentaire