Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to using regex to delete some data in python after beautifulsoup
    text
    copied!<p>i am using the beautifulsoup to scrape the HTML data.</p> <p>My issue is the output displays some information i donot want to see, so, i tried to use regex to delete that information,</p> <p>however, not good at regex, so i put my script here and the output i want, hope anyone can help me.</p> <p>regards</p> <p>my outputs now shows like:</p> <pre><code>&lt;title&gt;Music Games DVDs at JB Hi-Fi Australia&lt;/title&gt; Apple iPad mini 16GB Wi-Fi (Black) [Pick-up In-store Only]  &lt;span class="SKU"&gt;MD528X/A&lt;/span&gt; Apple iPad mini 16GB Wi-Fi (White) [Pick-up In-store Only]  &lt;span class="SKU"&gt;MD531X/A&lt;/span&gt; Apple iPad mini 32GB Wi-Fi (Black) [Pick-up In-store Only]  &lt;span class="SKU"&gt;MD529X/A&lt;/span&gt; </code></pre> <p>however, i only want it show like:</p> <pre><code>JB Hi-Fi Australia Apple iPad mini 16GB Wi-Fi (Black) Apple iPad mini 16GB Wi-Fi (White) </code></pre> <p>the following is my script</p> <pre><code>url1="http://www.jbhifionline.com.au/support.aspx?post=1&amp;results=10&amp;q=ipad+mini&amp;source=all&amp;bnSearch.x=0&amp;bnSearch.y=0" page=urllib2.urlopen(url1) soup = BeautifulSoup(page.read()) #website source site name : &lt;title&gt;Music Games DVDs at JB Hi-FiAustralia&lt;/title&gt; sitename1=soup.html.head.title print sitename1 ##issue here!!output shows &lt;title&gt;....&lt;/title&gt; #website source name:&lt;td class="check_title"&gt;Apple iPad mini 16GB Wi-Fi (Black) [Pick-up In-store Only]&lt;span class="SKU$` productname1=soup.findAll('td',{'class':'check_title'}) for eachproductname1 in productname1: print eachproductname1.renderContents().replace("^&lt;span&gt;","") </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload