Problems Parsing Lines in a Text File
<p>I have a .txt file with a number of lines in the format "subject,value,workload" that I want to print to a dictionary in the format dict[subect]: (value, workload). This is my code for doing so: </p>

<pre><code>for line in inputFile:
        lineList.append(line.split(",", 3))
for i in range(0, len(lineList)):
        subjectDict[lineList[i][0]] = (lineList[i][1], lineList[i][2])
        print subjectDict[lineList[i][0]]
</code></pre>

<p>However, running the program, my subjectDict values are being returned in tuples with this format: "'6', '2\r\n'." What's with this r\n business? I'm assuming it has something to do with the line breaks in the text file, which is why I put in the 3 maximum in my split method in the first place, but it seems to be interpreting 2\r\n as one string. Also, is there a more efficient way to turn these list items in the tuple each into integers, or should I just do:</p>

<pre><code>subjectDict[lineList[i][0]] = (int(lineList[i][1]), int(lineList[i][2])) 
</code></pre>

<p>Thanks. </p>
