Wednesday, 11 September 2013

Reading data from a file in Python

Reading data from a file in Python

I have a data file that looks like this:
1,100
2,200
3,-400
4,500
As you can see, each data point has 2 components When I do
file.readlines() they all come up as strings such as '1,100\n' so I am
wondering how would I make them into integers?

No comments:

Post a Comment