Does anybody know the syntax of turning a list of lists into something that looks like what I have drawn below?
The list of lists would look like so:
list = [0, [~, ~, ~], 1, [~, ~, ~], 2, [~, ~, ~] ]
And this is the desired output:
0 ~ ~ ~
1 ~ ~ ~
2 ~ ~ ~
I've seen other people ask a similar question however their sub-lists only had one element, and there were no integer elements in front of each sub-list either, and so they used the following in order to obtain the result that I need:
"\n".join(item[0] for item in list)
I'm not sure how to manipulate the above line of code to solve my specific problem. I tried changing
item[0] to item[0:len(sub_list)]
and many other things but nothing has worked. (I'm quite inexperienced with Python)
Any help would be greatly appreciated. Thanks.