import network
ssid = 'Xiaomi_1702'
password = '1233344455'
wlan = network.WLAN(network.STA_IF)
wlan.active(True)  # 激活接口
if not wlan.isconnected():
    print('连接到WiFi...')
    wlan.connect(ssid, password)  # 连接到WiFi
    while not wlan.isconnected():
        pass  # 等待连接
print('连接成功')
print(wlan.ifconfig())  # 打印网络配置信息,包括IP地址