Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Anything can be a list

  • Comma separated values
  • In square brackets
  • Can be any value, and a mix of values: Integer, Float, Boolean, None, String, List, Dictionary, ...
  • But usually they are of the same type:
  • Distances of astronomical objects
  • Chemical Formulas
  • Filenames
  • Names of devices
  • Objects describing attributes of a network device.
  • Actions to do on your data.
stuff = [42, 3.14, True, None, "Foo Bar", ['another', 'list'], {'a': 'Dictionary', 'language' : 'Python'}]
print(stuff)

Output:

[42, 3.14, True, None, 'Foo Bar', ['another', 'list'], {'a': 'Dictionary', 'language': 'Python'}]