mirror of
https://github.com/micropython/micropython.git
synced 2026-01-08 13:10:21 +01:00
examples/network/: Use getaddrinfo() result in easy way.
Instead of extracting 4th element, extact last. Much easier to remember!
This commit is contained in:
@@ -13,7 +13,7 @@ def main(use_stream=True):
|
||||
|
||||
ai = _socket.getaddrinfo("google.com", 443)
|
||||
print("Address infos:", ai)
|
||||
addr = ai[0][4]
|
||||
addr = ai[0][-1]
|
||||
|
||||
print("Connect address:", addr)
|
||||
s.connect(addr)
|
||||
|
||||
Reference in New Issue
Block a user