Sir, I'm using Python to scarp several data from the website and the data should be added to the list box.
I'm using requests module and beautiful soup to pull out contents from the website. Python version 3.5.1
for var in soup.find_all('div',class_="row"):
var1 = var.text
list1.insert(END,var1)
here soup = BeautifulSoup(Content pulled using request)
when printing the var1 I do get the desired output like this,
Dairy Milk
Dairy Milk is the most selling chocolate brand in India and is the most popular one among people of all ages. It is manufactured by Cadbury India, an Indian subsidiary of Cadbury, which is a British multinational company. Fruit and Nut, Crackle and Roast Almond are popular variants of Dairy Milk Chocolate.
But when I try to add this in a list box using an insert statement the list box treats the content in the var1 as a single object so I get my output in a single very very long horizontal line.
Kindly help me with this sir
Thank you for your time sir
What I have tried:
I thought since the loop is iterating after every insert statement I added a new line like this,
for var in soup.find_all('div',class_="row"):
var1 = var.text
list1.insert(END,var1)
list1.insert(END,"\n")
but no use since the whole stuff is inserted first and then it goes for a new line.
Used in and if like this ,
if "\n" in var1:
list1.insert(END,"\n")
but no use to.
I referred in the internet for "Python Tkinter - inserting data into a list box as it is" but got irrelevant results.
Kindly help me with this sir
Thank you for your time sir