Hi,
I am trying to find out the index of a substring in a string. "in" tells that the string is present but "find" is returning -1.
Somebody please guide me how can I get the index of substring in the string.
Following is the output:
I am trying to find out the index of a substring in a string. "in" tells that the string is present but "find" is returning -1.
Code:
import numpy as np
cnt = 0
response = "the following information: Your Email address."
ind = "Your Email address".find(response)
print("index =", ind)
if "Your Email address" in response:
print("Yes")
Following is the output:
Zulfi.index = -1
Yes