0

Hello. Pls tell me how to find second 'f' in the string like "oooofooof? I know only find and rfind operators((

27th Oct 2016, 3:56 PM
RomaSky
6 Answers
+ 3
String = "oooofooof" Count=0 for char in String: Count += 1 if char == "f": print(Count) >5 >9
27th Oct 2016, 5:15 PM
Adrian Ellis
Adrian Ellis - avatar
+ 1
You can loop trough the string letter by letter and compare if the current letter is 'f'
27th Oct 2016, 5:08 PM
Bartosz Jurus
Bartosz Jurus - avatar
0
Thanks guys!!!
27th Oct 2016, 5:18 PM
RomaSky
0
strong.index[f] I think this works too, I'm new but trying
28th Oct 2016, 4:52 AM
lil_gibby
0
string not strong, sorry auto correct on my phone
28th Oct 2016, 4:52 AM
lil_gibby
0
Found an easy answer, if you need to find second substring) Print(string.find('f', string.find('f') + 1))
28th Oct 2016, 6:11 AM
RomaSky