Did I find the right examples for you? yes no Crawl my project Python Jobs
All Samples(2) | Call(1) | Derive(0) | Import(1)
@see: http://stackoverflow.com/questions/166506/finding-local-ip-addresses-using-pythons-stdlib Returns IP address(es) of current machine. :return:
def get_ipv4_address(): """ @see: http://stackoverflow.com/questions/166506/finding-local-ip-addresses-using-pythons-stdlib Returns IP address(es) of current machine. :return: """ p = subprocess.Popen(["ifconfig"], stdout=subprocess.PIPE) ifc_resp = p.communicate() patt = re.compile(r'inet\s*\w*\S*:\s*(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})') resp = patt.findall(ifc_resp[0]) return resp
from PyQt4 import QtGui, Qt, QtCore from PyRQ.Core.Utils.NetworkUtils import get_ipv4_address class SetHostDialog(QtGui.QDialog):
def _getAllHosts(self): hosts = get_ipv4_address() try: localHost = hosts.pop(hosts.index("127.0.0.1")) except Exception, _e: