title: Encrypting a text file but leaving the space in?
body: <p>I've successfully managed to create a code which encrypts the text file using the randomly generated offset factor earlier in the program but I don't know how to leave the spaces where they are without encrypting them?</p>
  
  <pre><code>text_file = open("sample.txt", "r")
  
  characters = []
  for line in text_file:
      for c in line:
          characters.append(c)
  
  text_ascii = []
  text_number = 0
  new_number = 0
  cipher_text = ""
  for i in characters:
      if i not in (" "):
          text_ascii = ord(i)
          text_number = text_ascii + offset_factor
          if text_number &gt; 126:
              text_number = text_number - 94
          new_number = chr(text_number)
          cipher_text = cipher_text + new_number
  
  print (cipher_text)
  </code></pre>
  
  <p>The code I have now doesn't encrypt the spaces or include them at all.</p>
  
  <p>The content of the text file (called 'sample.txt' and all on one line) is:</p>
  
  <p>Somewhere in la Mancha, in a place whose name I do not care to remember, a gentleman lived not long ago, one of those who has a lance and ancient shield on a shelf and keeps a skinny nag and a greyhound for racing.</p>