title: Efficient way to split R, G and B values from a file containing RGB values (Without NumPy)
body: <p>I am having a file that contains RGB values. Like,</p>
  <h2>Sample Image Data.txt file</h2>
  <p>Each row contains triplets (like 255,255,255) separated by spaces.
  <br>
  Each triplet has three comma separated integers. These integer corresponds to R ('RED'), G ('GREEN') and B ('BLUE') values. All integers are less than 256.</p>
  <pre><code>255,255,255 250,250,250 254,254,254 250,250,250 
  255,255,255 253,253,253 255,255,255 255,255,255 
  251,251,251 247,247,247 251,251,251 250,250,250
  195,195,195 191,191,191 195,195,195 195,195,195
  255,255,255 253,253,253 254,254,254 255,255,255 
  255,255,255 254,254,254 239,239,239 240,240,240
  238,238,238 254,254,254 255,255,255 255,255,255
  </code></pre>
  <p>The processed output should look like:<br>
  RED = <code>['255','250','254','250','255','253','255',............,'254','255','255']</code><br>
  GREEN = <code>['255','250','254','250','255','253','255',............,'254','255','255']</code><br>
  BLUE = <code>['255','250','254','250','255','253','255',............,'254','255','255']</code><br>
  RGB_Nx3_MATRIX = <code>[['255','255','255'],['250','250','250'],['254','254','254'].....['255','255','255']]</code></p>
  <h3>My code works fine.</h3>
  <pre><code>import re
  
  file_object = open('Image Data.txt','r') 
  
  RED_VECTOR = []         #SEQUENTIALLY STORES ALL 'R' VALUES
  GREEN_VECTOR = []       #SEQUENTIALLY STORES ALL 'G' VALUES
  BLUE_VECTOR = []        #SEQUENTIALLY STORES ALL 'B' VALUES
  
  RGB_Nx3_MATRIX = []     #Nx3 MATRIX i.e. ['R','G','B'] N times
  
  for line in file_object:
      SPACE_split_LIST = line.split()
  
      for pixel in SPACE_split_LIST:
          RGB = re.findall(r'\,?(\d+)\,?',pixel)
          RED_VECTOR += [RGB[0]]
          GREEN_VECTOR += [RGB[1]]
          BLUE_VECTOR += [RGB[2]]
  
          RGB_Nx3_MATRIX += [RGB]
  
  
  
  
  #RESULTS
  
  #print RED_VECTOR
  #print GREEN_VECTOR
  #print BLUE_VECTOR
  
  #print &quot;------------------&quot;
  
  #print RGB_Nx3_MATRIX
  </code></pre>
  <h2>What am I looking for?</h2>
  <p>I need a better and efficient way to do this. I want to avoid the use of two for-loops.</p>