Hi - This is a simple problem, I'm sure, but I'm stumped. I need to read only one column from a multi-column file. The column is always in the same position, so I've decided to simply isolate the location in the row while reading the data. Here is my code:
data = open ("files/" + data + ".txt", 'r')
for line in data:
line = line[34:38]
file_list = line.readline()
But I'm getting an error message which says: "AttributeError: 'Str' has no attribute 'readline'
The data appears as follows:
01/27/2009,0840,80.13,80.17,79.81,79.99,16462,29701
01/27/2009,0845,79.97,79.99,79.37,79.44,65375,55565
01/27/2009,0850,79.48,79.57,79.31,79.42,35650,33070
01/27/2009,0855,79.44,79.89,79.41,79.87,35252,18583
01/27/2009,0900,79.87,79.98,79.74,79.77,33092,39951
01/27/2009,0905,79.75,80.01,79.68,80.01,6386,6000
Thanks so much for your help. Also, if you can suggest a better way just to read one of the columns, that would also be appreciated. I know I'm in trouble if the characters between each comma start to vary. grant-