title: When i try to make python write user input to a txt file, it doesn't
body: <p>i am learning python, and i wanted to create a little login and register program, that writes the username and the password to a txt file (so that it can be later used), i am currently working on the register function, when i try to write to the txt files it does nothing, i tried doing a with loop, a .flush() and .close() but neither of them saves the info.
  Here's my code:</p>
  
  <pre><code>        username.write = input ('username &gt; ')
          password = open("password.txt", "w")
          password.write = input ('password &gt; ')
          print('Welcome.')
          username.close()
          password.close() 
  </code></pre>
  
  <p>What am i missing?
  Edit.
  Neither 3 of the solutions to the suggested question work for me...</p>