First time poster, utter beginner at BS, Python and programming in general, really. Trying to learn as I go along, so apologies if this is a really obvious question.I've managed to write a function that fetches a webpage and turns the stuff I'm interested in into elements in a list.--from bs4 import BeautifulSoup
from urllib2 import urlopen
def get_category_links(section_url):
html = urlopen(section_url).read()
soup = BeautifulSoup(html)
gameLinks = soup.findAll("td","name")
return gameLinks
print gameLinks()
Which produces a list with this type of elements: <td class="name"><a href="/premier-league-2012-2013/arsenal-wigan-1405/">Arsenal - Wigan</a></td>
What I want to do is generate a new list containing certain pieces of this string. Specifically, I want to grab the four characters right before the /" inside the second html tag - so from this element, I'd like to grab 1405. What would the best way to proceed be?
You received this message because you are subscribed to the Google Groups "beautifulsoup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to beautifulsou...@googlegroups.com.
To post to this group, send email to beauti...@googlegroups.com.
Visit this group at http://groups.google.com/group/beautifulsoup?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.