June 2017
Beginner
352 pages
8h 39m
English
Elements are removed using a keyword with which we have not yet become acquainted: del. The del keyword takes a single parameter which is a reference to a list element and removes it from the list, shortening the list in the process:
>>> u = "jackdaws love my big sphinx of quartz".split()>>> u['jackdaws', 'love', 'my', 'big', 'sphinx', 'of', 'quartz']>>> del u[3]>>> u['jackdaws', 'love', 'my', 'sphinx', 'of', 'quartz']
Read now
Unlock full access