I am attempting to index my list, and then call on the last two values in each list separately.
For example
['Ashe', '1853282.679', '1673876.66', '1 ', '2 \n']
['Alleghany', '1963178.059', '1695301.229', '0 ', '1 \n']
['Surry', '2092564.258', '1666785.835', '5 ', '6 \n']`
I want my code to return (1, 2) #from the first list (0, 1) #from the second list (5, 6) #from the third list
my code so far includes:
def calculateZscore(inFileName, outFileName):
inputFile = open(inFileName, "r")
txtfile = open(outFileName, 'w')
for line in inputFile:
newList = (line.split(','))
print newList
inputFile.close()
txtfile.close()
if __name__ == "__main__":
main()
(I have been making attempts at indexing but the fact that there is a string in my list has been making it difficult)
First, don’t put quotes around your program code. Second, here are some quick pointers:
As an aside, it looks like you are reading CSV file. python has built-in CSV processing that you may want to consider: