title: reading text file and putting some characters in lists
body: <p>My objective is to transform this text in a textfile (all in 1 line):</p>
  
  <pre><code>a b s d p
  5 4 3 3 2
  ..........
  ....pp..s.
  ........s.
  .a......s.
  .a.....b..
  .a.....b..
  .a.....b..
  .a.ddd.b..
  ..........
  ..........
  </code></pre>
  
  <p>And have an output: [['a', 'b', 's', 'd', 'p'],[5, 4, 3, 3, 2]]
  But I get the following error:
      ship_characters.append(str(char))
  MemoryError</p>
  
  <p>Here is my code:</p>
  
  <pre><code>def read_ship_data(game_file):
  
      ship_characters = []
      ship_sizes = []
  
      game = open(game_file, 'r')
      for line in game:
          for char in line:
              while char != '.':
                  if char.isalpha():
                      ship_characters.append(str(char))
                  elif char.isnumeric():
                      ship_sizes.append(int(char))
      return [ship_characters , ship_sizes]
  </code></pre>