title: Python- making a set from a text file
body: <p>I have a text file. The guts of it look like this/ all of it looks like this (has been edited. This was also not what it initially looked like)</p>
  
  <pre><code> (0, 16, 0)
   (0, 17, 0)
   (0, 18, 0)
   (0, 19, 0)
   (0, 20, 0)
   (0, 21, 0)
   (0, 22, 0)
   (0, 22, 1)
   (0, 22, 2)
   (0, 23, 0)
   (0, 23, 4)
   (0, 24, 0)
   (0, 25, 0)
   (0, 25, 1)
   (0, 26, 0)
   (0, 26, 3)
   (0, 26, 4)
   (0, 26, 5)
   (0, 26, 9)
   (0, 27, 0)
   (0, 27, 1)
  </code></pre>
  
  <p>Anyway, how do I put these values into a set on python 2?</p>
  
  <p>My most recent attempt was </p>
  
  <pre><code>om_set = set(open('Rye Grass.txt').read()
  </code></pre>
  
  <p>EDIT: This is the code I used to get my text file.
  import cv2
  import numpy as np
  import time</p>
  
  <pre><code>om=cv2.imread('spectrum1.png')
  om=om.reshape(1,-1,3)
  om_list=om.tolist()
  om_tuple={tuple(item) for item in om_list[0]}
  om_set=set(om_tuple)
  
  im=cv2.imread('1.jpg')        
  im=cv2.resize(im,(100,100))         
  im= im.reshape(1,-1,3)
  im_list=im.tolist()
  im_tuple={tuple(item) for item in im_list[0]}
  ColourCount= om_set &amp; set(im_tuple)
  with open('Weedlist', 'a') as outputfile:
      output = ', '.join([str(tup) for tup in sorted(ColourCount)])
      outputfile.write(output)
  print 'done'
  
  im=cv2.imread('2.jpg')        
  im=cv2.resize(im,(100,100))         
  im= im.reshape(1,-1,3)
  im_list=im.tolist()
  im_tuple={tuple(item) for item in im_list[0]}
  ColourCount= om_set &amp; set(im_tuple)
  with open('Weedlist', 'a') as outputfile:
      output = ', '.join([str(tup) for tup in sorted(ColourCount)])
      outputfile.write(output)
  print 'done'
  </code></pre>