title: how to separate list in python?
body: <pre><code>fruit,apple
  fruit,tomato
  vegetable,carrot
  fruit,pear
  vegetable,celery
  vegetable,cabbage
  vegetable,cauliflower
  fruit,banana
  </code></pre>
  
  <p>I want to separate list from fruit and vegetable  like this</p>
  
  <p>fruit   </p>
  
  <pre><code>apple 
  tomato 
  pear 
  banana
  </code></pre>
  
  <p>Vegetable</p>
  
  <pre><code>carrot
  celery
  cabbage
  cauliflower
  </code></pre>
  
  <p>this is my code that i did so far</p>
  
  <pre><code>infile = open("hw16.txt","r")
  lines = infile.readlines()
  infile.close()
  
  print lines
  x = []
  y = []
  for i in range(0, len(lines)):
      tokens = lines[i].rstrip('\n').split(",")
      x.append(str(tokens[0]))
      y.append(str(tokens[1]))
  print  x
  print y
  </code></pre>
  
  <p>thank you</p>