这是123.py的代码
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import chardet
import urllib2
import re
import MySQLdb as mdb
import time
import json
from pyquery import PyQuery as pq
from bs4 import BeautifulSoup as bs
f=open('123.html','r')
htm=f.read()
f.close()
#print(type (htm))
soup=bs(htm,'html5lib')
123.html是知乎上抓的一个内容页面,由于内容太多,源码贴近来后提示内容长度超过限制,所以就没办法贴内容了。之前运作是正常的,现在提示好像是类型错误,不知道是怎么回事?
这个是问题的url。https://www.zhihu.com/question/22313393