解决脚本兼容urllib和urllib2(python2和python3) alex119文章9评论 2018年4月6日 20:57:00python语言评论阅读模式解决脚本兼容urllib和urllib2(python2和python3)有时候在写叫脚本的时候遇到python2和3的问题,有时候很头疼下面是解决python中的urllib使用的方法,提供一个参考 try: from urllib.request import urlopen, Request # Python 3except ImportError: from urllib2 import urlopen, Request # Python 2文章末尾固定信息 点赞 https://www.qnjslm.com/ITHelp/876.html 复制链接 复制链接
评论