python - How to get text from a <div> with a 'style' attribute? -


i address information school link. html i'm interested in looks this:

<div style="float:left;width:100%;padding-top:10px;padding-bottom:30px;">   <div>1936 north st.</div>   <div>natchitoches, tx 75962</div>   <div>936-468-2901</div> </div> 

the desired text be:

1936 north st. natchitoches, tx 75962 936-468-2901 

here attempted:

address = soup.find('div', 'float:left;width:100%;padding-top:10px;padding-bottom:30px;') print address 

my output: none

i thought soup.find() took attribute argument, , 'style' attribute, passing name of attribute me contents ...

any suggestions or beautifulsoup implementation how address text?

this want:

address = soup.find('div', {'style':'float:left;width:100%;padding-top:10px;padding-bottom:30px;'}) print address.get_text() 

use dict define style attr

use get_text() text between tags


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -