博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Python string find
阅读量:4030 次
发布时间:2019-05-24

本文共 635 字,大约阅读时间需要 2 分钟。

Python String find() Method


Advertisements


Description

It determines if string str occurs in string, or in a substring of string if starting index beg and ending index end are given.

Syntax

str.find(str, beg=0 end=len(string))

Parameters

  • str -- This specifies the string to be searched.

  • beg -- This is the starting index, by default its 0.

  • end -- This is the ending index, by default its equal to the lenght of the string.

Return Value

Index if found and -1 otherwise.

Example

#!/usr/bin/pythonstr1 = "this is string example....wow!!!";str2 = "exam";print str1.find(str2)print str1.find(str2, 10)print str1.find(str2, 40)

Result

1515-1

转载地址:http://mlhbi.baihongyu.com/

你可能感兴趣的文章
性能调优之iftop命令详解
查看>>
非关系型数据库(nosql)介绍
查看>>
移动端自动化测试-Windows-Android-Appium环境搭建
查看>>
Xpath使用方法
查看>>
移动端自动化测试-Mac-IOS-Appium环境搭建
查看>>
Selenium之前世今生
查看>>
Selenium-WebDriverApi接口详解
查看>>
Selenium-ActionChains Api接口详解
查看>>
Selenium-Switch与SelectApi接口详解
查看>>
Selenium-Css Selector使用方法
查看>>
Linux常用统计命令之wc
查看>>
测试必会之 Linux 三剑客之 sed
查看>>
Socket请求XML客户端程序
查看>>
Java中数字转大写货币(支持到千亿)
查看>>
Java.nio
查看>>
函数模版类模版和偏特化泛化的总结
查看>>
VMware Workstation Pro虚拟机不可用解决方法
查看>>
最简单的使用redis自带程序实现c程序远程访问redis服务
查看>>
redis学习总结-- 内部数据 字符串 链表 字典 跳跃表
查看>>
iOS 对象序列化与反序列化
查看>>