How do I print the Images?

Posted by user1477539 on Stack Overflow See other posts from Stack Overflow or by user1477539
Published on 2012-07-01T15:11:12Z Indexed on 2012/07/01 15:15 UTC
Read the original article Hit count: 154

Filed under:
|
|

I want to print the images of the 30 nba teams drafting in the first round. However when I tell it to print it prints out the link instead of the image. How do I get it to print out the image instead of giving me the image link. Here's my code:

import urllib2
from BeautifulSoup import BeautifulSoup
# or if your're using BeautifulSoup4:
# from bs4 import BeautifulSoup

soup = BeautifulSoup(urllib2.urlopen('http://www.cbssports.com/nba/draft/mock-draft').read())

rows = soup.findAll("table", attrs = {'class': 'data borderTop'})[0].tbody.findAll("tr")[2:]

for row in rows:
  fields = row.findAll("td")
  if len(fields) >= 3:
    anchor = row.findAll("td")[1].find("a")
    if anchor:
      print anchor

© Stack Overflow or respective owner

Related posts about python

Related posts about python-2.7