title: Compare user input string to text file python
body: <p>I have a text file filled with sample usernames and I would like to compare it to a user input to see if there is a match. If content matches it will return "This is a match" and if not it will return "That is not a match."</p>
  
  <pre><code>filename = 'UserNames.txt'
  
  with open(filename) as f_obj:
      nameLists = f_obj.read()
  
  name = input("Enter a username: ")
  
  if name in nameLists:
      print(name + " is a match" )
  else:
      print( name + "is not a match")
  </code></pre>
  
  <p>This worked to a degree but will return is a match if the user entered something similar. Ex: text file has blizz1730, user enters blizz. It comes out as a match</p>