Given the text file
sample.txt
2012-01-01 09:00 San Diego Men's Clothing 214.05 Amex
2012-01-01 09:00 San Diego Women's Clothing 153.57 Visa
2012-01-01 09:00 Omaha Music 66.08 Cash
I want to be able to read only the text for the third column. This code
for line in open("sample.txt"):
city=line.split()[2]
print(city)
can read the third column to a certain degree:
San
San
Omaha
but what I want is:
San Diego
San Diego
Omaha
How do I do this?