Please, I am just learning:
Can anyone tell me how I can remove the tags in the below output(Result) and get my answer in an array like
Address = [a,b,c,d,r......]
# Result:
Can anyone tell me how I can remove the tags in the below output(Result) and get my answer in an array like
Address = [a,b,c,d,r......]
1 2 3 4 5 6 7 8 9 10 |
from bs4 import BeautifulSoup as bs print ( 'bs4 imported.' ) # url_get = requests.get(url) soup = BeautifulSoup(url_get.content, 'html.parser' ) # address = soup.find_all( 'p' , class_ = "nospc" ) # First 2 addresses of the places of attraction address |
Output:<p class="nospc">Address: Nobels gate 32, N-0268 Oslo</p>,
<p class="nospc">Address: Akershus Festning, 0015 Oslo</p>,
<p class="nospc">Address: Frederiks gate 2, 0164 Oslo</p>,
<p class="nospc">Address: Universitetsgata 13, Oslo</p>,
<p class="nospc">Address: Tøyengata 53, 0578 Oslo</p>,
<p class="nospc">Address: Bellevue, Oslo</p>,
<p class="nospc">Address: Frederiks gate 2, 0164 Oslo</p>,
<p class="nospc">Address: Bygdøynesveien 39, 0286 Oslo</p>,
<p class="nospc">Address: Kongeveien 5, 0787 Oslo</p>,
<p class="nospc">Address: Karl Johansgt. 11, 0154 Oslo</p>,
<p class="nospc">Address: Rådhuset, 0037 Oslo</p>,
<p class="nospc">Address: Bryggegata 9, 0120 Oslo</p>,
<p class="nospc">Address: Sars gate 1, 0562 Oslo</p>,
<p class="nospc">Address: Kirsten Flagstads Plass 1, 0150 Oslo</p>]