I am learning web scraping. I wrote the following code:
import bs4
from urllib.request import urlopen as uReq
from bs4 import BeautifulSoup as soup
my_url= 'DON'T WANT TO SHARE'
uClient= uReq(my_url)
page_html= uClient.read()
uClient.close()
page_soup= soup(page_html, "html.parser")
contents=page_soup.findAll("data")
print (contents)
Upon printing the contents I am getting something like this:
<data>
------------------------------------
SIM: B01N2W56MD
(P)UBLISHER NAME: Monster
------------------------------------
(I)[ 0] Publisher: Monster
(I)[ 1] Title: Monster
(I)[12] Subject Keyword: nos
------------------------------------
(S)[ 0] Marketplace ID: 1
(S)[ 1] Replenishment Category: Non Replenishable
(S)[ 5] Title type: Main title 1
(S)[ 9] Product Group: No operation Product Handling Group
(S)[19] Product Subcategory: A
(S)[32] Are batteries required?: N
------------------------------------
(K)[ 0] IDC: 030347493342
(K)[ 1] ORC: 6800532606463
------------------------------------
</data>
How can I extract these values and print or store them, i.e., the value of SIM or Title or IDC and ORC.