title: How do i check if two strings are on the same line in a file?
body: <p>I have a program where I ask the user their username and password, and it checks a file to see if they have the correct username and password. Each username and password is stored on its own line.</p>
  
  <p>this is what I have</p>
  
  <pre><code>if username and password in open("logininfo").read():
      print("logged in succesfully")
  else:
      print("Incorrect username or password")
  </code></pre>
  
  <p>the problem i'm having with this is that any username can be used with any password since it check the whole file. Is there any way to check if they're on the same line in the file?</p>