Created
April 30, 2017 20:42
-
-
Save meelih/a23d3a65e21745d8f4a9f7449accc3aa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import subprocess | |
import shlex | |
p1 = subprocess.Popen(shlex.split("ifconfig wlan0"),stdout=subprocess.PIPE,stderr=subprocess.PIPE) | |
p2 = subprocess.Popen(shlex.split("awk '/inet addr:/ {print substr($2,6)}'"),stdin=p1.stdout,stdout=subprocess.PIPE,stderr=subprocess.PIPE) | |
out, err = p2.communicate() | |
print "out:", out[:-1] | |
print repr(out[:-1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment