I am a beginner so forgive me if my code looks like a joke.
I can return a single character, but I don't know if I am using the wrong format I was trying the split method because I thought I could return several parts of a sentence for example if it had 1 2 3 4 5 6 7 I thought I could search and return
2 5 7 but it will only work if they are next to each other or an exact match I guess. I may have don it incorrectly. I couldn't make the split work.
This is the last somewhat working version I had.
If anyone could help or point me in the right direction I would appreciate it.
Thanks for your time and help.
I can return a single character, but I don't know if I am using the wrong format I was trying the split method because I thought I could return several parts of a sentence for example if it had 1 2 3 4 5 6 7 I thought I could search and return
2 5 7 but it will only work if they are next to each other or an exact match I guess. I may have don it incorrectly. I couldn't make the split work.
This is the last somewhat working version I had.
Code:
look_in = raw_input ("Enter the search file to look in ")
search = raw_input ("Enter your search item ")
file = open(look_in, "r").read().count(search)
if file: print search, ",", file,"Of your search was found"
else: print "Your search was not found"
Thanks for your time and help.
Comment