title: Reading comma separated values from text file in python
body: <p>I have a text file consisting of 100 records like</p>
  
  <pre><code>fname,lname,subj1,marks1,subj2,marks2,subj3,marks3.
  </code></pre>
  
  <p>I need to extract and print lname and marks1+marks2+marks3 in python. How do I do that?<br>
  I am a beginner in python.  </p>
  
  <p>Please help</p>
  
  <p>When I used split, i got an error saying</p>
  
  <blockquote>
    <p>TypeError: Can't convert 'type' object to str implicitly.</p>
  </blockquote>
  
  <p>The code was</p>
  
  <pre><code>import sys
  file_name = sys.argv[1]
  file = open(file_name, 'r')
  
  
  for line in file:
      fname = str.split(str=",", num=line.count(str))
      print fname
  </code></pre>