|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 Anastasia 于 2017-7-24 12:02 编辑
import urllib.request
import os
def get_page(url):
req = urllib.request.Request(url)
req.add_header('user-agent','Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36')
response = urllib.request.urlopen(url)
html = response.read().decode('utf-8')
a = html.find('current-comment-page') + 23
b = html.find(']',a)
print(html[a:b])
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
=========== RESTART: D:\Pycharm project\hello world\download_mm.py ===========
>>>
怎么什么也打印不出来,求大神赐教 |
|