Replies: 2 comments 3 replies
-
string="hello how are you i am programming in python , i am also using github"
key="h"#can be single or multi
occurance=[]#this is +ve index
for i in range(len(string)-len(key)+1):
if string[i:i+len(key)]==key:
occurance.append(i)
#print(occurance)
occurance_rev = [i-len(string) for i in occurance]
print(occurance_rev) |
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
Rinx1er
-
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hello
I have a long string i want to search for a small string/character and record all indexes in list but with reverse index
Can anyone help me?
Beta Was this translation helpful? Give feedback.
All reactions