随笔分类 -  Python

python学习记录
摘要:1、unittest模块引用 2、单元测试类创建 单元测试类必须继承unittest.TestCase 单元测试类必须以test_开始方法名称 单元测试运行通过unittest.main()方法 3、测试断言 assertEqual(a,b) assertNotEqual(a,b) assertTr 阅读全文
posted @ 2019-03-03 07:50 mopheify 阅读(115) 评论(0) 推荐(0)
摘要:函数带名字的代码块,用于完成具体工作。 def 函数名(形参1,形参2): 函数体 #user_name 是形参 def greet_user(user_name): """显示简单的问题语""" print("Hello:"+user_name.title()+"!") #juice是实参 gre 阅读全文
posted @ 2019-03-03 07:12 mopheify 阅读(276) 评论(0) 推荐(0)
摘要:只能包含字母、数字、下划线,以字母、下划线开头,不能以数字开头 变量名不能包含空格 不要将关键字做为变量名 小写字母声名变量 变量名简短又具有描述性 字符串,str ;使用双引号或者单引号包括,推荐使用单引号 数字 字符串拼接 a="hello" name="Jack" greeting=a+nam 阅读全文
posted @ 2019-02-18 21:13 mopheify 阅读(181) 评论(0) 推荐(0)
摘要:1、官网下载安装包 https://www.python.org/downloads/ 选择系统、版本。 2、安装,注意勾选 Add Python x.x To Path 一路Next,也可自定义安装路径。 3、打开powershell 安装完成。 阅读全文
posted @ 2019-02-03 06:42 mopheify 阅读(137) 评论(0) 推荐(0)