regex - Python Regular Expressions not returning what I am looking for -
i scraping website , content inside specific tag. tag i'd content inside is: <pre class="js-tab-content"></pre>
here code:
request = urllib.request.request(url=url) response = urllib.request.urlopen(request) content = response.read().decode() tab = re.findall(r'<pre class="js-tab-content">(.*?)</pre>', content) print(tab)
when print tab empty list []
here content searching in:
.... <pre class="js-tab-content"><i></i><span>em</span> <span>d</span> <span>em</span> <span>d</span> lift m ac cahir og face, brooding o'er old disgrace <span>em</span> <span>d</span> <span>g</span>-<span>d</span>-<span>em</span> black fitzwilliam stormed place , drove fern. <span>em</span> <span>d</span> <span>em</span> <span>d</span> gray said victory sure, firebrand he'd secure <span>em</span> <span>d</span> <span>g</span>-<span>d</span>-<span>em</span> until met @ glenmalure, feach mac hugh o'byrne chorus: <span>g</span> <span>d</span> curse , swear, lord kildare, feach feach dare <span>g</span> <span>g</span>-<span>d</span>-<span>em</span> fitzwilliam have care, fallen star low <span>g</span> <span>d</span> halbert, out sword, on go lord <span>g</span> <span>g</span>-<span>d</span>-<span>em</span> feach mac hugh has given word: follow me carlow tassagart ____to clonmore flows stream of saxon gore great rory og o'more @ sending loons hades. white sick , lane fled, black fitzwilliams head we'll send over, dripping red, liza , ladies see swords of glen imayle flashing o'er english pale see children of gael, beneath o'byrne's banners rooster of fighting stock, let saxon cock crow out upon irish rock, fly , teach him manners </pre> ....
i not see why returning empty list instead of string inside list content inside.
i have looked around internet around half hour , couldn't find help.
sorry if stupid here, if obvious!
anyway, in advance!
tab = re.findall(r'<pre class="js-tab-content">(.*?)</pre>', content, re.s)
re.s
required .
match newline characters.
Comments
Post a Comment