[Fixed]-Beautiful Soup: not grabbing correct information

1πŸ‘

βœ…

The problem seems to be that the flowers have been paginated across pages.
Something like this should help you loop through the different pages.
CODE not tested

import urllib2
test = {'A':'', 'B':'-B', 'XYZ': '-X-Y-Z'}
flower_list = []
for key, value in test.items():
     page = urllib2.urlopen('http://www.all-my-favourite-flower-names.com/list-of-flower-names{0}.html'.format(
value)).read()
     soup = BeautifulSoup(page)
     # Now do your logic or every page, and probably save the flower names in a list.
πŸ‘€akotian

Leave a comment