python-字符串
字符串的定义
格式:
双引号或者单引号中的数据,就是字符串
- b = “hello usian.cn”
- b = ‘hello usian.cn’
输入输出
输入:
a = input(“请输入数据:”)
输出:
print(“输出结果显示”)
切片
语法
[起始下标:结束:步长]
字符串常见操作
查找:find()
查找:index()
查询数量:count()
替换:replace()
分割:split()
去除两边字符串:strip()
删除字符串两端的空白字符: