How could I join the sublist inside a list? I had done this,
from collections import deque
new_list = []
def sort_sequence(lst):
lst = "".join([str(i) for i in lst])
lst = [list(i + "0") for i in lst.split("0") if i]
lst = [[int(j) for j in i] for i in lst]
lst = [sorted(k) for k in lst]
for i in range(len(lst)):
item = deque(lst[i])
item.rotate(-1)
new_list.append(list(item))
print(new_list)
sort_sequence([1,3,2,0,5,4,6,0,2,3,4,0])
For example:
I want this list [[1, 2, 3, 0], [4, 5, 6, 0], [2, 3, 4, 0]] as [1, 2, 3, 0, 4, 5, 6, 0, 2, 3, 4, 0]
Please help me with this.