Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from string import *
- key_s = raw_input("Enter the string you want to search. > ")
- target_s = raw_input("Enter what you are searching for. > ")
- def count_sub_string_match_recursive(key_s, target_s):
- recur_counter = 0
- x = find(key_s, target_s)
- while x >= 0:
- key_s = key_s[:x] + key_s[x+len(target_s):]
- recur_counter += 1
- x = find(key_s, target_s)
- return recur_counter
- print "This is how many times it shows up.", count_sub_string_match_recursive(key_s, target_s)
Advertisement
Add Comment
Please, Sign In to add comment