0

Can any one help me

Import string Print(string.find("abcdabcdabcdabcdabcd", "cd", 7,13)

25th Feb 2021, 1:58 PM
Ravikumar
Ravikumar - avatar
1 Answer
+ 2
I will try to help, but im not sure what you need. i will try to provide general information on the subject. The string module is very outdated, but this is what i found with help(“string”): find(s, *args) find(s, sub [,start [,end]]) -> in Return the lowest index in s where substring sub is found, such that sub is contained within s[start,end]. Optional arguments start and end are interpreted as in slice notation. Return -1 on failure. index(s, *args) index(s, sub [,start [,end]]) -> int Like find but raises ValueError when the substring is not found. Me: Today, find and index are implemented as a built-in methods of the str class, so you could just type “larry”.find(“a”, 0, 3) to search for “a” in the first 3 letters of the word. After looking at your code some more, i see you capitalized the print function. this is incorrect, and will generate a simple error “NameError: Name Print is not defined.”
25th Feb 2021, 2:12 PM
Wilbur Jaywright
Wilbur Jaywright - avatar