- Mastering Python Scripting for System Administrators
- Ganesh Sanjiv Naik
- 58字
- 2021-07-02 14:00:24
Updating tuples
Tuple updating is not possible in Python, as tuples are immutable. But you can create a new tuple with an existing tuple, as shown in the following example:
#!/usr/bin/python3
cities = ('Mumbai', 'Bangalore', 'Chennai', 'Pune')
numbers = (1,2,3,4,5,6,7)
tuple1 = cities + numbers
print(tuple1)
Output:
('Mumbai', 'Bangalore', 'Chennai', 'Pune', 1, 2, 3, 4, 5, 6, 7)
推薦閱讀
- 精通JavaScript+jQuery:100%動態網頁設計密碼
- Visual Basic程序開發(學習筆記)
- Web Scraping with Python
- Interactive Data Visualization with Python
- Ext JS Data-driven Application Design
- Learning Bayesian Models with R
- Mastering Rust
- Mastering Linux Network Administration
- Creating Stunning Dashboards with QlikView
- Java程序設計基礎(第6版)
- Learning Concurrency in Python
- Python機器學習與量化投資
- Pandas 1.x Cookbook
- Getting Started with RethinkDB
- Spring Boot學習指南:構建云原生Java和Kotlin應用程序