摘要: 字符串方法的操作:capitalize、upper、lower、swapcase、title、center、expandtabs、replace等 # TODO:字符串是不可变对象, 所以任何操作对原字符串不会有任何影响 str = "python⽜BA" # 首字母大写 res = str.cap 阅读全文
posted @ 2020-06-11 13:21 奔奔-武 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 字符串切割函数split,以及需要留意的深坑! # 字符串切割 str = "我的昵称是奔奔,我的年龄是18,我的爱好是python" res = str.split(",") print(res) # 指定切割次数 res = str.split(",", 1) print(res) # TODO 阅读全文
posted @ 2020-06-11 11:39 奔奔-武 阅读(2141) 评论(0) 推荐(0) 编辑