title: How to split a file
body: <p>I have text file in this format:</p>
  
  <pre><code>10900   PART1   3211034
  10900   PART2   3400458
  10900   PART4   3183857
  10900   PART3   4152115
  10900   PART5   3366650
  10900   PART6   1548868
  10920   PART3   4154075
  10920   PART2   3404018
  10920   PART1   3207571
  10920   PART4   3178505
  10920   PART6   1882924
  10920   PART5   3363267
  10940   PART6   2183534
  10940   PART3   4153924
  10940   PART4   3178554
  10940   PART1   3207436
  10940   PART5   3363585
  10940   PART2   3404220
  </code></pre>
  
  <p>And I want to split the file - first, by first column; and second, by the summation of column 3 not greater than 10000000.</p>
  
  <p>Here's my code to split file base on first Column:</p>
  
  <pre><code>file1=open ('Normal_All_TracNum_mod')
  data=[]
  
  for line in file1.readlines():
  line_split=line.split()
  data.append(line_split)
  
  RCV_check= data[0][0]
  filewrite=open(RCV_check,"w")
  
  for i in range(0,len(data)):
      if (data[i][0] == RCV_check):
          filewrite.write(data[i][0]+ "          "+data[i][1]+'\n')
  
      else:
          RCV_check=data[i][0]
          filewrite.close()
          filewrite=open(RCV_check,"w")
          filewrite.write(data[i][0]+ "          "+data[i][1]+'\n')   
  filewrite.close()
  </code></pre>
  
  <p>Output As I want:</p>
  
  <pre><code>File 1
   10900  PART1   3211034
   10900  PART2   3400458
   10900  PART4   3183857
  File 2
   10900  PART3   4152115
   10900  PART5   3366650
   10900  PART6   1548868
  ...etc
  </code></pre>
  
  <p>I need in each file has same column One And Summation (3211034 +3400458 + 3183857) of column 3 not greater than 10000000 and so on for other files.............  </p>