ã¾ãã«ãã®çºæ³ã¯ãªãã£ãâ¦â¦ã¨ããæããªã®ã§ãã ãããã ãä¸å½ã§ãããã使ã£ããã¨ããã人ã«ã¯ã馴æã¿ã®"8.8.8.8"ã«æ¥ç¶ãã ããã§è¿ã£ã¦ããã½ã±ããåããã£ã¦èªåã®IPãããæ¹æ³ãããã¾ãã import socket s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(("8.8.8.8", 80)) s.getsockname() # >>> ('192.168.100.101', 52964) s.getsockname()[0] # >>> '192.168.100.101'æååã§è¿ã£ã¦ããã®ã§ãæ¨æºã©ã¤ãã©ãªipaddressã¨ã®é£åãå¯è½ import ipaddress paddress.ip_address(s.getsockname()[0]) IPv4Address('192.168
{{#tags}}- {{label}}
{{/tags}}