官网下载安装python
在VS code里面安装python插件 https://www.cnblogs.com/bloglkl/archive/2016/08/23/5797805.html
/*
没报错则证明urllib安装成功
*/
from urllib.request import urlopen
pip install beautifulsoup4//安装beautifulsoup4
/*
没报错验证beautifulsoup4安装
*/
from bs4 import BeautifuSoup
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import io
import sys
from urllib import request
sys.stdout = io.TextIOWrapper(sys.stdout.buffer,encoding=‘utf8‘) #改变标准输出的默认编码
resp = request.urlopen("http://www.baidu.com/")
print (resp.read().decode("utf-8"))
原文:http://www.cnblogs.com/jieshendada/p/7835218.html