csvfile = open('teams.csv')
reader = csv.DictReader(csvfile)
for each in reader:
Manchester United,George Best,138
Note - the windows above contain a CSV file (teams.csv) and a Python script that can parse this teams.csv file.
Ensure both files are saved in the same
CSV stands for comma-separated values.
That's because the values are separated with commas.
The first line in a CSV file is (usually) a header row, containing column headings for the records. Note: a header row is not a requirement of CSV files.
CSV files aren't hierarchical
(unlike XML and JSON), meaning it is difficult to show parent / child organisational patterns in data with CSV.
is a dictionary in Python that preserves the order in which the elements were inserted.