This section focuses on the following issues:
1. What are the built-in types of 6 sequences in Python?
2. What are the similarities and differences between lists and tuples?
1. What are the built-in types of 6 sequences in Python?
Python contains 6 built-in sequences, which are lists, tuples, strings, Unicode strings, buffer objects, and Xrange objects. The operations common to a sequence include: index, length, combination (sequence addition), repetition (multiplication), Shard, check member, Traverse, minimum, and maximum values.
2. What are the similarities and differences between lists and tuples?
Python has 6 built-in types of sequences, but the most common are lists and tuples.
Lists and tuples are similar, with the following aspects:
Same point:
1, all have the characteristics of the sequence, can be a sequence of common operations;
2, usually used in parentheses, and the elements in parentheses appear as comma-separated values, data items do not need to have the same type;
3, all contain built-in functions Max, Min, Len;
4, can be converted to each other;
Similarities and differences point:
1. Define Different
1) The list is enclosed in square brackets.
2) tuples are enclosed in parentheses.
2. Is it possible to modify
1) list can be modified
2) tuples cannot be modified
3. Conversion Mode
1) List of tuples: tuple (seq)
2) Tuples to lists: list (seq)
4. Whether the built-in method is included
1) The list provides 11 built-in methods List.append (obj), list.count (obj), list.extend (seq), List.index (obj), List.insert (index, obj), List.pop ([Index=-1]]), List.remove (obj), List.reverse (), List.sort (Cmp=none, Key=none, Reverse=false), List.clear (), List.copy ();
2) tuples do not provide built-in methods
What are the built-in types of 6 sequences in Python python?