What is the difference between {} and [] in python?

  • columnNames = {} defines an empty dict
  • columnNames = [] defines an empty list

These are fundamentally different types. A dict is an associative array, a list is a standard array with integral indices.

I recommend you consult your reference material to become more familiar with these two very important Python container types.

Leave a Comment