About adding / deleting lists (Python beginners after learning Ruby)

Addition / deletion of list, etc.

A Python list is like an array in Ruby.

list.py


list = [0, 1, 2]
len(list)  #Check the number of elements in the list, in this case 3
list.append(3)  #Add an element to the end of the list, in this case a comma after 2 and a 3
list.pop(3)  #Deletes the element with the specified number in the list, in this case 3 is deleted

By the way, csv files are also treated as a list separated by commas, so you can operate the list.

Recommended Posts

About adding / deleting lists (Python beginners after learning Ruby)
About list processing (Python beginners after learning Ruby)
Learning flow for Python beginners
About python beginner's memorandum function
About Perl, Python, PHP, Ruby
Lists, functions, for, while, with (open), class and learning supplements up to the last time (Python beginners after learning Ruby)
Machine learning summary by Python beginners
<For beginners> python library <For machine learning>
Memorandum of python beginners About inclusion notation
python learning
# 1 Python beginners make simple English word learning tools
Python vs Ruby "Deep Learning from scratch" Summary
A story about modifying Python and adding functions
About shallow and deep copies of Python / Ruby
About Python external module import <For super beginners>