📜  python 检查互联网连接 - Python 代码示例

📅  最后修改于: 2022-03-11 14:47:25.287000             🧑  作者: Mango

代码示例3
import urllib2

def internet_on():
    try:
        urllib2.urlopen('http://216.58.192.142', timeout=1)
        return True
    except urllib2.URLError as err: 
        return False