First, note that that's not a list of lists, but just a list of strings that, when concatenated, might look like one or more (nested) lists, in particular with those [
and ]
in the first and last element. Thus, you could join those strings with ,
to a string that actually represents a pair or tuple of lists, and then eval
or ast.literal_eval
those. Then just use a list comprehension to flatten that actual list of lists.
>>> lst = ['[175', '178', '182', '172', '167', '164]', "['b']"]
>>> ','.join(lst)
"[175,178,182,172,167,164],['b']"
>>> ast.literal_eval(','.join(lst))
([175, 178, 182, 172, 167, 164], ['b'])
>>> [x for sub in ast.literal_eval(','.join(lst)) for x in sub]
[175, 178, 182, 172, 167, 164, 'b']