取得ip === ```python= import socket def get_ip(): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(("8.8.8.8", 80)) ip = s.getsockname()[0] s.close() return ip print(get_ip()) ``` ## Ref. [Python 取得 ip 的方法](https://shengyu7697.github.io/python-get-ip/) ###### tags: `實作相關`