2017-07-24 6 views
-1
[<input class="mail opentip" 
     data-original-title="Your temporary Email address" 
     data-placement="bottom" 
     id="mail" 
     onclick="select(this);" 
     readonly="" 
     title="" 
     type="text" 
     value="[email protected]"/>] 

Wie kann ich beautifulsoup der E-Mail-Extrakt: "[email protected]"Wie Wert in BeautifulSoup extrahieren zu versteckt

+2

Mögliche Duplikat von [ Extrahieren eines Attributwerts mit beautifulsoup] (https://stackoverflow.com/questions/2612548/extracting-an-attribute-value-with-beautifulsoup) – kristaps

+0

Verwenden: 'supp.find ('input', {'id': ' mail '}). get (' Wert ') ' –

Antwort

0

Sie diese verwenden:

from bs4 import BeautifulSoup 
text = '''<input class="mail opentip" data-original-title="Your temporary Email address" data-placement="bottom" id="mail" onclick="select(this);" readonly="" title="" type="text" value="[email protected]"/>''' 

parse = BeautifulSoup(text, 'lxml') 

for z in parse.find_all('input', {'class':"mail opentip"}): 
    print(z['value']) 
Verwandte Themen