SyntaxFix
Write A Post
Hire A Developer
Questions
>>> s="mystring" >>> s.index("r") 4 >>> s.find("r") 4
"Long winded" way
>>> for i,c in enumerate(s): ... if "r"==c: print i ... 4
to get substring,
>>> s="mystring" >>> s[4:10] 'ring'