How would I go about making a list like
My_list = [['Item1', 'item2'], ['shark', 'dog', 'cat']]
To two lists like the following:
My_list = ['Item1', 'item2']
My_list2 = ['shark', 'dog', 'cat']
Also, how would I go about doing this if I didn't know how many lists were in the list?
My_list = ['Item1', 'item2']['shark', 'dog', 'cat']? It is not a valid expression.My_list = ['Item1', 'item2', 'shark', 'dog', 'cat']then the answer is:sum(My_list,[])orlist(itertools.chain.from_iterable(My_list)). See also this related question.