I have some python code that I wrote to convert a python list into an XML element. It\'s meant for interacting with LabVIEW, hence the weird XML array format. Anyways, here\
start inside out:
def group(seq, k): return [seq[i:i+k] for i in range(0, len(seq), k)] unflattened = group(group(data, 2), 2)
Your example might be easier, if your dimensions were not all the same. But I think the above code should work.