在python中,如何在元素值内刮取t\value

在python中,如何在元素值内刮取t\value,python,html,web-scraping,beautifulsoup,Python,Html,Web Scraping,Beautifulsoup,我到处找了,但找不到答案 我需要得到elemant值内的值,例如,我需要从下面得到Xerox Workcenter 7220的值,请帮助 <input id="ni.VEe17e1924dbe4e7400d17a5ca0b961966_read_only" name="ni.VEe17e1924dbe4e7400d17a5ca0b961966_read_only" class="cat_item_option sc-content-pad form-control" value="Xero

我到处找了,但找不到答案

我需要得到elemant值内的值,例如,我需要从下面得到Xerox Workcenter 7220的值,请帮助

<input id="ni.VEe17e1924dbe4e7400d17a5ca0b961966_read_only" name="ni.VEe17e1924dbe4e7400d17a5ca0b961966_read_only" class="cat_item_option sc-content-pad form-control" value="Xerox WorkCentre 7220" readonly="true">
输出 “施乐7220工作中心”


请发布一个代码示例,说明您正试图执行的操作,因为它不太清晰res=requests.get res1=res.text soup=BeautifulSoupres1,'html.parser'input_tag=soup.findinput,{class:form control disabled}printinput_标记当我尝试此操作时,它显示printinput_标记['value']TypeError:“NoneType”对象不是Subscriptable在您试图废弃的站点中没有禁用窗体控件的类
from bs4 import BeautifulSoup

soup=BeautifulSoup(html,'html.parser')
html='''<input id="ni.VEe17e1924dbe4e7400d17a5ca0b961966_read_only" name="ni.VEe17e1924dbe4e7400d17a5ca0b961966_read_only" class="cat_item_option sc-content-pad form-control" value="Xerox WorkCentre 7220" readonly="true">'''

input_tag = soup.find('input')
print(input_tag['value'])