I have the following HTML document
<p>
"Year: 1932"
<br>
<br>
"Total Share : 0.5 Lakhs (Pure Estimate)"
<br>
<br>
"Verdict"
</p>
I am currently using BeautifulSoup to obtain the other elements in HTML, but I am unable to get a way to get these lines as is. I am getting them in a single line.
Try like this
from bs4 import BeautifulSoup
response_data = <Your html tags>
soup_data = BeautifulSoup(response_data, features="html5lib")
string_data = soup_data.find('p').text.strip().replace("\n", ",").replace("\"", "").split(',')
data_list=[]
for strng in string_data:
if strng.strip():
data_list.append(strng.strip())
print(data_list)