title: Python 3: encryption using dictionaries
body: <p>This is part of my code:</p>
  
  <pre><code>def encrypt_file(file_choice):
      encryption_key = {
  "a": 1, "b": 3, "c": 5, "d": 7,"e": 9, "f": 11,"g":        
  13, "h": 15, "i": 17, "j": 19,"k": 21, "l": 23, "m": 
  25, "n": 27, "o": 29, "p": 31, "q": 33, "r": 35, "s":
   37, "t": 39, "u": 41,"v": 43,"w": 45,"x": 47, "y": 49, "z": 51}
  
  keys = encryption_key.keys()
  </code></pre>
  
  <hr>
  
  <p>So, I have loaded a text file (file_choice) in another function. And I want every character in the text file, namely (a, b, c etc.) to be given the respective value from the dictionary.</p>
  
  <p>For example if the text has the word "and". I want to create a for-loop that sets the "a" in "and" to "1", "n" in "and" to "27" and "d" in "and" to "7".</p>
  
  <p>So my main problem is that I cannot effectively set the characters in the text file to the respective value in the dictionary. Or more specifically, I want to translate the text file into numbers.</p>
  
  <p>Anyone has an idea of how to create such a loop?</p>