您的位置:首页 > 编程语言 > Python开发

python test0729.py

2013-08-05 09:39 429 查看
#!/usr/env  python
#-*- coding: utf-8  -*-
import urllib
import urllib2
import random
import requests
import os,sys
import MySQLdb
from BeautifulSoup import BeautifulSoup
from sgmllib import SGMLParser
import re
def main():
t="https://play.google.com/store/apps/category/PERSONALIZATION"

html=requests.get(t)
result=html.content

print type(result)
soup=BeautifulSoup(result)
temp=soup.prettify("utf-8")
pattern=re.compile('<a class="title" href="(.+?)" title')
dataresult=re.findall(pattern,temp)
print dataresult
print len(dataresult)
print type(temp)
f=file("hello.txt","w+")
f.writelines(temp)
f.close()
if  __name__=="__main__":
main()
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: