发布网友 发布时间:2022-05-10 19:37
共1个回答
热心网友 时间:2023-07-28 09:28
importsocketdefget_ip():s=socket.socket(socket.AF_INET,socket.SOCK_DGRAM)try:#doesn'tevenhavetobereachables.connect(('10.255.255.255',0))IP=s.getsockname()[0]except:IP='127.0.0.1'finally:s.close()retur