python的 find()用法
2015-11-11 16:04
274 查看
函数原型:find(str, pos_start, pos_end)
解释:
str:被查找“字串”
pos_start:查找的首字母位置(从0开始计数。默认:0)
pos_end: 查找的末尾位置(默认-1)
返回值:如果查到:返回查找的第一个出现的位置。否则,返回-1
举例:
>>> str="abcdef"
>>> str.find("e")
4
解释:
str:被查找“字串”
pos_start:查找的首字母位置(从0开始计数。默认:0)
pos_end: 查找的末尾位置(默认-1)
返回值:如果查到:返回查找的第一个出现的位置。否则,返回-1
举例:
>>> str="abcdef"
>>> str.find("e")
4
相关文章推荐
- python2 中编码问题
- python2 编码问题详解
- Python之list
- Python 错误 UnicodeEncodeError: 'ascii' codec can't encode character 的解决方案
- python 正则表达式口诀
- Python3.x那些事儿:[27]更多List操作
- 《用Python玩转数据》第2周学习笔记(Part1)
- [python] Layer2攻击
- Python中pygame的mouse鼠标事件用法实例
- python 学习笔记
- Python基于pygame实现的font游戏字体(附源码)
- Python中的字典
- python 基于小顶堆实现随机抽样
- python 类的几种方法(函数)
- python unittest库 官方网站
- python基础之virtualenv
- (10)python字符格式化
- python安装lib库
- python爬虫(1)
- python中pygame针对游戏窗口的显示方法实例分析(附源码)