How to make a python program capable of executing the ifconfig command and displaying its output on the screen?

Asked

Viewed 44 times

-1

Good morning!!!

I need to make a python script capable of executing the ipconfig command and displaying its output on the screen. Anyone knows how I can do it?

1 answer

2

Hello, to achieve the desired result, just use the module subprocess

Follow an example:

import subprocess
subprocess.call(["ifconfig"])

ifconfig is a linux command that lists network interfaces.

To use in windows just replace the ifconfig for ipconfig.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.