- 博客(8)
- 收藏
- 关注
原创 python自动化单元测试工具----doctest
unit testing An automatic procedure used to validate that individual units of code are working properly. Python has doctest built in for this purpose.doctest是python内置模块,用于进行简单的单元测试 Doctests在函数或脚本体的第一
2017-02-14 10:02:43
423
转载 Python编程风格
We’ll have more to say about style as our programs become more complex, but a few pointers will be helpful already:use 4 spaces for indentation 缩进4个空格imports should go at the top of the file 应该在文件顶部导
2017-02-13 17:08:41
356
原创 Bool值的判断规则
The class bool is a subclass of the class int, and cannot be subclassed. bool类是int类的子类,但是不能被继承 既然bool是继承自int类型的所以很自然bool类型是支持数学运算的:>>> True+True2>>> True*True1>>> False*True0判定方法: 在python中and和or
2017-02-10 15:53:17
4210
原创 GASP的安装和执行
GASP (Graphics API for Students of Python) will enable us to write programs involving graphics. 安装Windows版GASP 在《How to Think Like a Computer Scientist Learning with Python 》4.11GASP章节中,需要安装GASP。通过文章给
2017-02-09 13:24:06
1879
原创 运算符与表达式
运算符 赋值运算符 ‘=’等于:x = 3,y = “abcde” ‘+=’加等于:x+=2 ‘-=’减等于:x-=2 ‘=’乘等于:x=2 ‘/=’除等于:x /=2 ‘%’求余等于:x %=2 算术运算符 ‘+’加法:x+y ‘-’减法:x-y ‘*’乘法:x*y ‘/’实数除法:3/2=1, 3.0/2=1.5 ‘//’整数除法:5.6/2=2.8, 5.6/
2016-08-08 16:33:42
1030
原创 变量
定义: 变量是计算机内存中的一块区域,变量可以存储规定范围内的值,而且值可以改变命名规则: 1. 由字母、数字、下划线组成,如a a1 a_ a_1 2. 数字不能开头 3. 不能使用关键字,如python,type 4. 最好使用有意义,容易理解的名字>>> a = 1>>> a1 = 1>>> a_ = 1>>> a_1 = 1>>> _a =1>>> 1a =
2016-08-08 14:14:52
181
原创 文件类型
源代码:py为扩展名,不需要编辑,由python程序解释 字节代码:pyc为扩展名,是python源文件经编译后生成的文件 编译方法:import py_compile py_compile.compile(“hello.py”)优化代码:pyo为扩展名,是经过优化的源文件 生成方法:python -O -m py_compile 1.py
2016-08-08 11:19:16
186
原创 认识Python
前言 大学没有好好学编程,毕业后做了7年软件测试,到现在也不会写代码,简直感到汗颜。以后测试的趋势还是得结合编程能力,遂下定决心学一门语言。经朋友介绍说Python相对好入门。于是开始看Python的视频课程。看了2遍,表示自己还是写不出简单的程序,今天开始看第3遍视频课程,一边看一遍记录,不知道这次效果会不会好一点。我也看看自己这颗猪头要看多少遍基础教程才能熟悉语法Python的由来 1989
2016-08-05 14:07:51
331
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人