随笔分类 - Language_Python
摘要:资料:https://docs.python.org/3/library/html.parser.html python 自带了一个类,叫 HTMLParser。 我们用的时候需要自己定义一个类,继承自 HTMLParser 。然后重写一部分方法。 下面是我们常用的解析html的方法,可以看到在 H
阅读全文
摘要:背景 json 是一种轻量级的数据交换格式。易于人阅读和编写,同时也易于机器解析和生成。 一般表现形式是一个无序的 键值对 的集合。 资料: 官方文档: https://docs.python.org/3/library/json.html#module-json python操作json的其他方式
阅读全文
摘要:背景 python 的unittest 没有自带数据驱动功能。 所以如果使用unittest,同时又想使用数据驱动,那么就可以使用DDT来完成。 DDT是 “Data-Driven Tests”的缩写。 资料:http://ddt.readthedocs.io/en/latest/ 使用方法 dd.
阅读全文
摘要:背景 Requests is an elegant and simple HTTP library for Python, built for human beings. Requests是一个优雅简洁的Python HTTP库,给人类使用。 Requests使用urllib3,所以拥有它的所有特性
阅读全文
摘要:httplib httplib: https://docs.python.org/2/library/httplib.html python 的官方文档这样说明: 总结起来就是:该库一般不直接使用,比较底层。 GET的官方例子: urllib urllib:https://docs.python.o
阅读全文
摘要:http http: https://docs.python.org/3/library/http.html http是一个包,里面含有多个模块:http.client,http.server,http.cookies,http.cookiejar。 http.client 对应python2.X
阅读全文
摘要:参考:Python PyH模块中文文档 样例 下面是官网的一个例子: 执行该脚本,会生成 a.html文件,用浏览器打开,显示如下: 单个语法解释 1. 使用自己的css或者js文件。 写好自己的css以及js文件,比如mystyle.css、myjs.js。 2. 使用标签 比如使用<h1>,其他
阅读全文
摘要:看到一篇很好的python读写excel方式的对比文章: 用Python读写Excel文件 关于其他版本的excel,可以通过他提供的链接教程进行学习。 XlsxWriter: https://github.com/jmcnamara/XlsxWriter http://xlsxwriter.rea
阅读全文
摘要:为什么要写下了呢? 因为本人找了好久,网上都是 “发送带有正文的邮件”或者“发送带有附件的邮件”。就没见到一篇是“发送带有正文+附件的邮件”。导致本人折腾这个折腾了好久,太浪费时间了。写下来留作后续参考。 下面是在邮件里面,正文显示 a.html内容,并且附件附上a.html。
阅读全文
摘要:关于virtualenv的资料: http://virtualenv-chinese-docs.readthedocs.org/en/latest/ 用的python3,但是搭建 Robot Framework需要用到python2,没办法只好搭建一个python虚拟机。 1. 安装 virtual
阅读全文
摘要:HTMLTestRunner.py python 2版本 下载地址:http://tungwaiyip.info/software/HTMLTestRunner.html 使用时,先建立一个”PyDev Package“,将下载下来的HTMLTestRunner.py文件拷贝在该目录下。 例子:te
阅读全文
摘要:pygame下载地址: https://bitbucket.org/pygame/pygame/downloads 12岁的少年教你用Python做小游戏 Beginning Game Programming for Teens with Python
阅读全文
摘要:1. unittest 参考文档: https://docs.python.org/3/library/unittest.html unittest笔记 The unittest unit testing framework was originally inspired by JUnit and
阅读全文
摘要:资料:https://docs.python.org/3/library/configparser.html环境python 3.4.4RawConfigParser方式example.cfg文件:[Section1]an_int = 15a_bool = truea_float = 3.1415b...
阅读全文
摘要:环境python:3.4.4准备xml文件首先新建一个xml文件,countries.xml。内容是在python官网上看到的。 1 2008 141100 4 2011 ...
阅读全文
摘要:环境python:3.4.4准备xml文件首先新建一个xml文件,countries.xml。内容是在python官网上看到的。 1 2008 141100 4 2011 ...
阅读全文
摘要:环境python:3.4.4准备xml文件首先新建一个xml文件,countries.xml。内容是在python官网上看到的。 1 2008 141100 4 2011 ...
阅读全文
摘要:教程一:行为驱动开发(BDD)基于Python的行为驱动开发实战:http://python.jobbole.com/81303/基于Python的行为驱动开发实战英语原文地址:http://code.tutsplus.com/tutorials/behavior-driven-developmen...
阅读全文
摘要:英文原文:http://pythontips.com/2013/07/31/10-python-blogs-worth-following/中文翻译参考:http://python.jobbole.com/81730/1. 第一个博客是 Planet python, 它无疑是最出名的python博客...
阅读全文
摘要:资料:https://github.com/spulec/pep8ify安装$ pip install pep8ify用法Usage: 2to3 [options] file|dir ...Options: -h, --help show this help message ...
阅读全文