Searching string from text file in Python
I'm trying to create a program in Python where a user enters a name they would like to search from a text file and the program either answers "Name found" or "Name not found".
I tried using all of the knowledge I have but cannot do it because even if you type the first letter of a name, the program says "Name found" which shouldn't happen.
Try adding a
; to the beginning and end of every name in the file (like ;Bob;) and do this:
name = input('Name: ') name = ';'+name+';' if name in file: print('yeehaw')