title: How to write 2 values in one line and read them later again? Python
body: <p>I want to create a Programm that saves login information in a file. So I think the best way is to write the username and password like this:</p>
  
  <pre><code>username # password
  </code></pre>
  
  <p>But how to writhe it so and how to read it again? My Code writes in 3 lines instead of one:</p>
  
  <pre><code>file = open(“testfile.txt”,”w”) 
  
  file.write(username) 
  file.write(“#”) 
  file.write(password) 
  
  file.close() 
  
  file = open(“testfile.txt”, “r”)
  print file.read(1)
  </code></pre>
  
  <p>How can I make the programm only write in one line?</p>
  
  <p><strong>Edit</strong> I need to save to 2 Values in the variables again.</p>