http://www.tutorialspoint.com/python/string_find.htm
Description:
This method determines if 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:
Here is the detail of parameters:
str: specifies the string to be searched.
start : starting index, by default its 0
end : ending index, by default its equal to the lenght of the string.
Return Value:
It returns index if found and -1 otherwise.
Example:
#!/usr/bin/python str1 = "this is string example....wow!!!"; str2 = "exam"; print str1.find(str2); print str1.find(str2, 10); print str1.find(str2, 40); |
This will produce following result:
15 15 -1 |
'Programming' 카테고리의 다른 글
goclipse: Eclipse-based IDE for Google's Go Programming Language (0) | 2012.05.31 |
---|---|
Python Modules (0) | 2012.05.30 |
Efficient String Concatenation in Python (0) | 2012.05.30 |
(Racket) Hash Tables (0) | 2012.05.29 |
[Python/OpenBook] 예제로 배우는 재미있는 Python (0) | 2012.05.29 |