current position:Home>Python series tutorials 116

Python series tutorials 116

2022-01-29 10:57:49 AI technology of artificial intelligence

friends , If you need to reprint, please indicate the source :blog.csdn.net/jiangjunsho…

Statement : During the teaching of artificial intelligence technology , Many students mentioned to me python Related issues , So in order to let the students master more extended knowledge and better understand AI technology , I put the assistant in charge of sharing this python Series of tutorials , I hope that helps ! Because of this python The tutorial wasn't written by me , So it's not as good as mine AI Technology teaching is humorous , It's boring to learn ; But its knowledge is in place , It's also worth reading !PS: If you don't understand this article, please read the previous article first , Step by step, learn a little everyday, and you won't find it difficult !

Tuples are very similar to lists , But tuples cannot be modified in place ( They are immutable ), And usually written in parentheses ( Not in square brackets ). Although tuples do not support any method calls , But tuples have most of the properties of a list . Let's take a quick look at its properties .

  • An ordered set of arbitrary objects

Similar to strings and lists , A tuple is a collection of ordered objects ( That is, its contents are maintained in order from left to right ). Same as the list , Can contain objects of any category .

  • Access by offset

With the string 、 The list is the same , Elements in tuples are offset ( Rather than a key ) To visit . They support all offset based operations . for example , Index and slice .

  • It belongs to the immutable sequence type

Similar to string , Tuples are immutable , They do not support operations that are applied to the list and modified in place . Similar to strings and lists , Tuples are sequences , They support many of the same operations .

  • Fixed length 、 isomerism 、 Any nesting

Because tuples are immutable , Cannot grow or shorten without generating a copy . On the other hand , Tuples can contain other composite objects ( for example , list 、 Dictionaries and other tuples ), So nesting is supported .

  • Object reference array

Similar to list , Elements in tuples contain references to objects . Tuples store access points to other objects ( quote ), thus , Indexing tuples is relatively fast .

Later, we will learn tuples in more detail step by step !

copyright notice
author[AI technology of artificial intelligence],Please bring the original link to reprint, thank you.
https://en.pythonmana.com/2022/01/202201291057472423.html

The sidebar is recommended

guess what you like

Random recommended