python 取得IP地址

 import socket
 socket.gethostbyname(socket.gethostname())
'192.168.18.10'

 

posted @ 2022-11-08 15:19  myrj  阅读(49)  评论(0)    收藏  举报