title: How to sort contents in a file in python
body: <p>I'm trying to figure out a simple way to sort words from a file, however the spaces "\n" are always returned when I print the words.
  How could I improve this code to make it work properly? I'm using python 2.7
  Thanks in advance.</p>
  
  <pre><code>def sorting(self):
      filename = ("food.txt")
      file_handle = open(filename, "r")
      for word in file_handle:
          word = word.split()
          print sorted(file_handle)
      file_handle.close()
  </code></pre>