Home>Article>Backend Development> Some commonly used operators and built-in functions in python

1. Operator
| Operator | Instance | Result | Description | Supported data types |
|---|---|---|---|---|
| [1,2] [3,4] | [1 ,2,3,4] | Merge | Strings, lists, tuples | |
| * | ['A' ]*4 | ['A','A','A','A'] | Copy | String, list, tuple |
| in | 3 in (1,2,3) | True | Whether the element exists | String, list , tuple, dictionary (to determine whether the key exists) |
| not in | 3 not in (1,2,3) | false | Whether the element does not exist | String, list, tuple, dictionary (to determine whether the key does not exist) |
2. Built-in function
| Function | Description |
|---|---|
| cmp(item1,item2) | Compare two values (When comparing dictionaries, compare keys first and then values) |
| len(item) | Calculate the number of container elements |
| max(item) | Returns the maximum value of the container |
| min(item) | Returns the minimum value of the container |
| del(item) | Delete variables |
For more related knowledge, please pay attention topython video tutorialcolumn
The above is the detailed content of Some commonly used operators and built-in functions in python. For more information, please follow other related articles on the PHP Chinese website!