CSE 163
CSVs and Lists of Dictionaries
��Hunter Schafer
This Time
Last Time
2
Dictionary Methods
3
dict() or {} | Makes an empty dictionary |
d[key] | Gets the value for k, KeyError if None |
d[key] = val | Assigns val as the value for key |
d.pop(key) | Removes key from this dictionary |
d.keys() | Returns a collection of the keys |
d.values() | Returns a collection of the values |
d.items() | Returns a collection of (key, value) tuples |
Processing CSVs
4
Name,Salary
Flora,3
Ken,1
Ryan,3
[
{'Name': 'Flora', 'Salary': 3},
{'Name': 'Ken', 'Salary': 1},
{'Name': ‘Ryan’, 'Salary': 3}
]
Group Work:
Best Practices
When you first working with this group:
Tips:
5