1. 首页
  2. 数据库
  3. 其它
  4. (MAX第五篇)Python–字符串操作(三)

(MAX第五篇)Python–字符串操作(三)

上传者: 2020-12-23 04:01:55上传 PDF文件 51.5KB 热度 19次
字符串操作(三)1. 替换或调整字符串2. 字符串格式化3. format()格式化3.1 字符串格式化3.2 数字format()格式化 此篇总结包含字符串的替换、转换以及字符串格式化 1. 替换或调整字符串 Code Return string.replace(str1, str2, num=string.count(str1)) 把 string 中的 str1 替换成 str2,如果 num 指定,则替换不超过 num 次 >>> string="Nobody Nobody but you" >>> string.replace('Nobody','Somebod
下载地址
用户评论