python3 sequence

There are a lot of built-in sequences in python

list

tuple

string

The concept of containers in python

list

tuple

string

dictionary

gather

 

 

 

 

can be changed, tuples are immutable

In almost all cases, a list can be used instead of a tuple. There is only one case where it is not possible. When a tuple is used as a dictionary key, a list cannot be used instead of a tuple, because the list cannot be changed.

 

Common operations for sequences:

Index, slice, add, multiply, membership check

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325237125&siteId=291194637