当前位置:网站首页>Basic knowledge of tuples
Basic knowledge of tuples
2022-07-05 03:17:00 【Programming is too difficult】
Catalog
Definition of tuple
Tuples :tuple
If you want to create an empty tuple , Don't write anything in brackets .
If there is only one data in the tuple , Then remember to add a comma .
If there is more than one data in the tuple , Data are separated by commas , There is no need to add a comma after the last data .
Access to tuple elements
Access to elements in tuples and list equally , Can be accessed by subscript .
Fill in brackets with -1 Indicates access to the last data ,list The same in China .
list And tuples can be sliced . Write... In brackets [ Start subscript : Terminate subscript ( But does not contain ): Step value ].
Basic operations on tuples
increase
You can connect two tuples with a plus sign , Open up a space to store the content after the connection .
Delete
use del After deleting tuples , The entire variable will be deleted , An error will be reported when using this variable next time , Indicates that this variable has not been defined .
modify
Data in tuples cannot be modified , however list Data that can be used as tuples ,list The data in can be modified .
lookup
The search operation is to traverse the data in tuples , By subscript operation .
Other operating
Tuples can also be like list Same count ,tup.count()
To turn a variable into a tuple , Write the variable name directly in tuple() In parentheses .
边栏推荐
- LeetCode 234. Palindrome linked list
- Jd.com 2: how to prevent oversold in the deduction process of commodity inventory?
- Mongodb common commands
- The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
- The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
- [groovy] string (string splicing | multi line string)
- Hot knowledge of multithreading (I): introduction to ThreadLocal and underlying principles
- Monitoring web performance with performance
- ELFK部署
- New interesting test applet source code_ Test available
猜你喜欢
Privatization lightweight continuous integration deployment scheme -- 01 environment configuration (Part 1)
College Students' innovation project management system
Design of KTV intelligent dimming system based on MCU
How to learn to get the embedding matrix e # yyds dry goods inventory #
Bumblebee: build, deliver, and run ebpf programs smoothly like silk
Port, domain name, protocol.
Class inheritance in C #
Master Fur
Tiny series rendering tutorial
Utilisation simple de devtools
随机推荐
問下,這個ADB mysql支持sqlserver嗎?
Pat class a 1162 postfix expression
Azkaban实战
Breaking the information cocoon - my method of actively obtaining information - 3
Idea inheritance relationship
Ask, does this ADB MySQL support sqlserver?
Yyds dry goods inventory embedded matrix
Use UDP to send a JPEG image, and UPD will convert it into the mat format of OpenCV after receiving it
Three line by line explanations of the source code of anchor free series network yolox (a total of ten articles, which are guaranteed to be explained line by line. After reading it, you can change the
Logstash、Fluentd、Fluent Bit、Vector? How to choose the appropriate open source log collector
【微服务|SCG】Filters的33种用法
51 independent key basic experiment
The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
VM in-depth learning (XXV) -class file overview
Moco V2 literature research [self supervised learning]
TCP security of network security foundation
Azkaban概述
[105] Baidu brain map - Online mind mapping tool
Anchor free series network yolox source code line by line explanation four (a total of ten, ensure line by line explanation, after reading, you can change the network at will, not just as a participan
Delphi free memory