网站首页
编程语言
数据库
系统相关
其他分享
编程问答
expandtabs
2024-06-12
Python3 笔记:字符串的 replace() 和 expandtabs()
1、replace()方法把字符串中的old(旧字符串)替换成new(新字符串),如果指定第三个参数max,则替换不超过max次。语法:str.replace(old,new[,max])参数:old:将被替换的子字符串。new:新字符串,用于替换old子字符串。max:可选参数,如果填写则表示替换不超过max次。str1='old