Different meanings of brackets in Python

前端 未结 3 1652
时光说笑
时光说笑 2020-11-30 23:17

I am curious, what do the 3 different brackets mean in Python programming? Not sure if I\'m correct about this, but please correct me if I\'m wrong:

[] - # No         


        
3条回答
  •  温柔的废话
    2020-11-30 23:53

    • []: Used to define mutable data types - lists, list comprehensions and for indexing/lookup/slicing.
    • (): Define tuples, order of operations, generator expressions, function calls and other syntax.
    • {}: The two hash table types - dictionaries and sets.

提交回复
热议问题