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()
相关文章推荐
- Python之使用unittest框架和HTMLTestRunner.py文件实现多个测试用例执行与测试报告生成
- Python 使用 HTMLTestRunner.py 生成测试报告
- python unittest/pyunit
- 在python3.X下修改了HTMLTestRunner.py
- 关于python无法显示中文的问题:SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no encoding
- CascadeCNN python测试程序详解(test.py)
- python使用 HTMLTestRunner.py生成测试报告
- Python单元测试框架之pytest---如何执行测试用例
- python test with pytest
- [已解决]关于python无法显示中文的问题:SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no encoding declared。
- Python单元测试框架之pytest -- 断言
- python pytest测试框架介绍三
- python unittest源码解析三----loader.py之_get_name_from_path(self, path)
- ./test.py 不工作? python test.py 工作
- [Python Test] Use pytest fixtures to reduce duplicated code across unit tests
- python - 中文打印报错SyntaxError: Non-ASCII character '\xe4' in file test.py on line 3, but no encoding declared。
- python pytest测试框架介绍一
- python里面Nose和pytest的区别
- 使用 py.test 对 python 代码进行测试
- apache+wsgi+python: Premature end of script headers: mytest.py