intf_ip = commands.getoutput('ip address show dev ' + intf).split()
intf_ip = intf_ip[intf_ip.index('inet') + 1].split('/')[0]
print(intf_ip)
How to get the physical interface IP address from an interface