- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to pop-up the first element from a Python tuple?
By definition, tuple object is immutable. Hence it is not possible to remove element from it. However, a workaround would be convert tuple to a list, remove desired element from list and convert it back to a tuple.
>>> T1=(1,2,3,4) >>> L1=list(T1) >>> L1.pop(0) 1 >>> L1 [2, 3, 4] >>> T1=tuple(L1) >>> T1 (2, 3, 4)
Advertisements
To Continue Learning Please Login
Login with Google