我正在处理我的代码中的一些错误,就是这样:#!/usr/bin/env python2# -*- coding: utf-8 -*-from BeautifulSoup import BeautifulSoup as beatsopfrom BeautifulSoup import SoupStrainer as sopstrainimport urllib2def html_parser(html_data):    html_proc = beatsop(html_data)    onlyforms = sopstrain("form")    forms1 = html_proc.findAll(onlyforms)    txtinput = forms1.findAll('input', {'type': 'text'})    #We take the forms that aren't text    listform = ["radio", "checkbox", "password", "file", "image", "hidden"]    otrimput = forms1.findAll('input', {'type': listform})    # we seach for names in text forms    for e_name in txtinput:        names = e_name['name']    #we seach for value in otrimput    for e_value in otrimput:        value1 = e_value.get('value')        if value1:            pass        else:            print('{} there is no value.'.format(e_value))html_data = urllib2.urlopen("http://www.google.com")html_parser(html_data)因此,有代码,它连接到google,并搜索表单(soupstrainer),一切正常,但是问题是,这向我显示了此错误:txtinput = forms1.findAll('input', {'type': 'text'})AttributeError: 'ResultSet' object has no attribute 'findAll'我认为错误是Forms1数据是一个列表,但我不明白如何修改代码以使其工作。
                    
                    
                添加回答
举报
0/150
	提交
		取消
	