最近爬虫知乎遇到的问题:
AttributeError: ‘NoneType’ object has no attribute ‘get’
意思是这个对象是空对象None,因此也就没有get属性。
完成程序如下:
#!/usr/bin/env python
# -*- coding:utf-8 -*-
from bs4 import BeautifulSoup
import requests
import time
def captcha(captcha_data):
with open("captcha.jpg", "wb") as f:
f.write(captcha_data)
text = input("请输入验证码:")
# 返回用户输入的验证码
return text
def zhihuLogin