摘要: 如何编写注释 在Python中,注释用井号(#)标识。井号后面的内容都会被Python解释器忽略 tuboshu 2022/3/30 #tuboshu 2022/3/30 print("学习如何编写注释 简洁 明了") 执行结果 学习如何编写注释 简洁 明了 进程已结束,退出代码为 0 阅读全文
posted @ 2022-03-30 18:25 NiceTwocu 阅读(27) 评论(0) 推荐(0) 编辑
摘要: 编写4个表达式,它们分别使用加法、减法、乘法和除法运算,但结果都是数字8。 print(2*4) print(6+2) print(8//1) print(12-4) print(round(8 / 1)) 执行结果 8 8 8 8 8 进程已结束,退出代码为 0 最喜欢的数字:将你最喜欢的数字存储 阅读全文
posted @ 2022-03-30 17:46 NiceTwocu 阅读(52) 评论(0) 推荐(0) 编辑
摘要: 个性化消息:将用户的姓名存到一个变量中,并向该用户显示一条消息。显示的消息应非常简单,如“Hello Eric, would you like to learn some Python today?”。 name = "Zxx" # 方法一 print("Hello"" " + name + ",w 阅读全文
posted @ 2022-03-30 12:39 NiceTwocu 阅读(85) 评论(0) 推荐(0) 编辑
摘要: 个性化消息:将用户的姓名存到一个变量中,并向该用户显示一条消息。显示的消息应非常简单,如“Hello Eric, would you like to learn some Python today?”。 栗子 name = "Zxx" #方法一 print("Hello"" " + name+",w 阅读全文
posted @ 2022-03-30 12:30 NiceTwocu 阅读(98) 评论(0) 推荐(0) 编辑
摘要: 撇号位于两个双引号之间,因此Python解释器能够正确地理解这个字符串: message="One of Python's strengths is its diverse community." print(message) 执行结果 One of Python's strengths is it 阅读全文
posted @ 2022-03-29 23:24 NiceTwocu 阅读(123) 评论(0) 推荐(0) 编辑
摘要: rstrip():删除字符串末尾空白 first_name="tuboshu " print(first_name) print(first_name.rstrip()) first_name=first_name.rstrip() print(first_name) lstrip():删除字符串行 阅读全文
posted @ 2022-03-29 23:16 NiceTwocu 阅读(31) 评论(0) 推荐(0) 编辑
摘要: \t 在字符串中添加制表符 点击查看代码 print("python") print("\t python") 执行结果 点击查看代码 python python \n 在字符串中添加换行符 点击查看代码 print("languages:\nPython\nc\njavaScript ") 执行结 阅读全文
posted @ 2022-03-29 23:08 NiceTwocu 阅读(54) 评论(0) 推荐(0) 编辑
摘要: 字符串就是一系列字符。在Python中,用引号括起的都是字符串,其中的引号 可以是单引号,也可以是双引号 title() :以首字母大写的方式显示每个单词,即将每个单词的首字母都改为大写。 点击查看代码 name = "cy lovelace" print(name.title()) 全部 uppe 阅读全文
posted @ 2022-03-29 15:16 NiceTwocu 阅读(26) 评论(0) 推荐(0) 编辑
摘要: 一、Fixture固件 部分用例之前或之后执行,部分类之前或之后执行。模块或会话之前或之后的操 作。 Fixture完整的方法如下: @pytest.fixture(scope="作用域",params="数据驱动",autouse="是否自动执 行",ids=“参数别名”,name="Fixtur 阅读全文
posted @ 2022-03-13 19:00 NiceTwocu 阅读(35) 评论(0) 推荐(0) 编辑
摘要: 一、Pytest详解以及常用的插件安装 1.pytest是一个非常成熟的基于python的单元测试框架(测试的是程序的最小单元:函 数,方法) python:unittest和pytest java: junit和testng 2.pytest可以和所有的自动化测试工具或模块:selenium,re 阅读全文
posted @ 2022-03-13 18:18 NiceTwocu 阅读(67) 评论(0) 推荐(0) 编辑