title: Dont know how to split .dat file lines
body: <p>so I have this project that needs me to read a .dat file and convert it into a table, the .dat file goes like this:</p>
  
  <pre><code>50123456_lam tai man_70.0_60.0_
  50223456_li tai man_60.0_90.5_
  50323456_wong tai man_34.5_30.0_
  50423456_ng tai man_90.5_70.0_
  50523456_lau tai man_86.0_92.4_
  50623456_chui tai man_70.0_64.5_
  50723456_lim tai man_64.5_60.0_
  50823456_pok tai man_37.5_35.50_
  50923456_kim tai man_92.4_60.0_
  50023456_tsang tai man_15.0_20.0_
  50999999_chan peter_100.00_80.00_
  </code></pre>
  
  <p>I wish to split the lines by their underscores so I can make a list with each element.
  As Im an amateur I can now only import the files into my program, I still need to figure out the way to split the lines into usable variables.</p>
  
  <p>This is the import program in question:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import fileinput
  import sys
  
  def main():
      lineNum = 0
      for line in fileinput.input('markdata.dat'):
          lineNum += 1
          sys.stdout.write(str(lineNum)+' ')
          sys.stdout.write(line)
      pass
  
  if __name__ == "__main__":
      main()
  </code></pre>
  
  <p>If anyone would like to help I'm appreciated.</p>