Slicing Lists for Sublists in Python


Extract portions of a list using slicing.

Source Code

sublist = my_list[1:3]  # Get items from index 1 up to but not including 3
print(sublist)
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments