- 统计字符串中某个字符出现的次数
tempStr = 'Hello world' count = tempStr.count('l') print count #输出结果为 3
- 待续
Python字符串常见操作
最新推荐文章于 2023-04-18 09:54:36 发布
tempStr = 'Hello world'
count = tempStr.count('l')
print count
#输出结果为 3