第一个python程序
# search IMDB TOP 250 in VeryCD
# Author: chenqian
# URL: www.stopdesign.cn
import urllib2
from BeautifulSoup import BeautifulSoup
page = urllib2.urlopen("http://www.imdb.com/chart/top")
soup = BeautifulSoup(page.read())
div=soup("table")[11]
vcurl=''
for i in div:
movies = i.contents[2].contents[0].contents[0].contents[0]
#print movies
vcurl+="<a href='http://www.verycd.com/search/folders/"+movies+"'>"+movies+"</a><br />\n"
# age print i.contents[2].contents[0].contents[1]
filename = "top250.html"
file = open(filename, 'w')
file.write(vcurl)
file.close()
标签: python
1 条评论:
I do not know whether it's just me or if perhaps everyone else encountering issues with your site. It looks like some of the text in your posts are running off the screen. Can someone else please provide feedback and let me know if this is happening to them too? This might be a problem with my web browser because I've had this happen before. Many thanks paypal login my account official site
发表评论
订阅 博文评论 [Atom]
<< 主页