- Mastering Python Scripting for System Administrators
- Ganesh Sanjiv Naik
- 74字
- 2021-07-02 14:00:25
Indexing, slicing, and matrices
Tuple indices work the same way as list indices. Values can be accessed using index. If you try to read or write an element that does not exist, you get IndexError. If an index has a negative value, it counts backward from the end of the list.
Now, we will create a tuple named cities and perform some index operations:
cities = ('Mumbai', 'Bangalore', 'Chennai', 'Pune')

推薦閱讀
- Web前端開發(fā)技術(shù):HTML、CSS、JavaScript(第3版)
- Visual FoxPro程序設(shè)計(jì)教程
- Hands-On Microservices with Kotlin
- Big Data Analytics
- 重學(xué)Java設(shè)計(jì)模式
- 學(xué)習(xí)正則表達(dá)式
- Java實(shí)戰(zhàn)(第2版)
- Mobile Device Exploitation Cookbook
- Access 2010數(shù)據(jù)庫應(yīng)用技術(shù)實(shí)驗(yàn)指導(dǎo)與習(xí)題選解(第2版)
- Elasticsearch Essentials
- Python+Office:輕松實(shí)現(xiàn)Python辦公自動(dòng)化
- Web編程基礎(chǔ):HTML5、CSS3、JavaScript(第2版)
- Learning WordPress REST API
- 秒懂算法:用常識解讀數(shù)據(jù)結(jié)構(gòu)與算法
- HTML5+CSS3+JavaScript案例實(shí)戰(zhàn)