使用 MicroPython 获取 IP 地址

Fetching the IP address using MicroPython

尝试使用 pybricks-micropython

想要获取本地主机 name/IP 地址。可以在 CPython 中使用此代码...但似乎不是我在 MicroPython 中找到的等效项?

hostName = socket.gethostname()
hostIPA = socket.gethostbyname(hostName)

正在网上搜索,但似乎找不到任何我可以使用的东西?

特别感谢 David Lechner,他为我指明了正确的方向并给出了 95% 的答案。

os.popen('hostname -I'.read().strip().split(" ")

给你IP4地址!