现在的位置: 首页 > 综合 > 正文

python test0729.py

2019年03月14日 ⁄ 综合 ⁄ 共 583字 ⁄ 字号 评论关闭

#!/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()
【上篇】
【下篇】

抱歉!评论已关闭.