title: Encrypting a Text File in Python, Preferably with a Module
body: <h1>Context:</h1>
  <p>I have a class, in which I have to make a password protected something or other.<br />
  (My instructor is not very specific.) The reason for me asking for a method in which I could use a standard import statement was so I could just upload a single folder that only contained a text file and the program itself.  I want to do something as follows:</p>
  <pre><code>#Import Statements Here
  outFile = open('myFile.txt',&quot;wt&quot;);
  
  #Here is the tricky part.
  #In place of all of these comments,
  #I want to encrypt the file with a key given by a user(in this case,givenKey):
  givenKey = input(&quot;Please input your key:&gt;&gt;&gt;&quot;);
  outFile.close();
  </code></pre>
  <hr />
  <h1>Resolution:</h1>
  <p>The answer by <strong>Sasszem</strong> was the one that worked for me. Look into the comments
  for a simplified explanation of the main answer. The person who gave me his/her custom made code (I cant remember who gave it to me, sorry.) had a good idea. But I don't like using code I don't understand. And finally, the person who gave me the Cryptography module as an idea wasn't wrong, but I use python on Windows.</p>