Making lists from list in python
Go to solution
Solved by Imbellis,
Do you mean something like this?
list1 = [['Sam', 'Canada', 'USA'], ['John', 'Mexico'], ['Albert', 'Canada']] Sublist = [] for i in range(len(list1)): # Loops though List1 Sublist = list1[i] # Setting Sublist to individual sections of list1 print(Sublist[1:]) # Skips first item in list
prints:
Spoiler
['Canada', 'USA']
['Mexico']
['Canada']
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now