#!/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()