from sh import ifconfig

print(ifconfig("wlan0"))


详见

http://amoffat.github.io/sh/