欢迎来到战五渣的博客

人生三重境界:昨夜西风凋碧树,独上高楼,望尽天涯路。 衣带渐宽终不悔,为伊消得人憔悴。 众里寻他千百度,蓦然回首,那人却在灯火阑珊处。
摘要: 一 列表的相关操作 1.1 列表的拼接 lst1 = [1,2,3] lst2 = [4,5,6] res = lst1 + lst2 print(res) 执行 [root@node10 python]# python3 test.py [1, 2, 3, 4, 5, 6] 1.2 列表的重复 l 阅读全文
posted @ 2020-02-06 22:56 梦中泪 阅读(264) 评论(0) 推荐(0) 编辑
摘要: 字符串的格式化 顺序传参 索引传参 关键字传参 容器类型传参(列表和元组) {}相当于占位符 1 顺序传参 strvar = "他{}牺牲自己,{}出卖组织" res = strvar.format("宁愿","也不") print(res) res = strvar.format("白白","忘了 阅读全文
posted @ 2020-02-06 21:56 梦中泪 阅读(383) 评论(0) 推荐(0) 编辑
摘要: 字符串相关函数 1 capitalize 字符串首字母大写 strvar = "this is a dog" res = strvar.capitalize() print(res) 执行 [root@node10 python]# python3 test.py This is a dog 2 t 阅读全文
posted @ 2020-02-06 20:06 梦中泪 阅读(359) 评论(0) 推荐(0) 编辑