摘要:
一 列表的相关操作 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 阅读全文
摘要:
字符串的格式化 顺序传参 索引传参 关键字传参 容器类型传参(列表和元组) {}相当于占位符 1 顺序传参 strvar = "他{}牺牲自己,{}出卖组织" res = strvar.format("宁愿","也不") print(res) res = strvar.format("白白","忘了 阅读全文
摘要:
字符串相关函数 1 capitalize 字符串首字母大写 strvar = "this is a dog" res = strvar.capitalize() print(res) 执行 [root@node10 python]# python3 test.py This is a dog 2 t 阅读全文