My result data is in a list of tuples, which each have a list in them:
[(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'], ['I', 'J', 'K', 'L', 'M', 'N']),
...
(['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'], ['I', 'J', 'K', 'L', 'M', 'N'])]
What’s the best way to strip all the nesting and quotes and write A:N to a tab delimited file?
The quotes are not part of the string, they denote the string. You would not be able to remove them.
The
csvmodule makes this taks pretty straightforward:This results in a file where each row corresponds to a tuple and a row contains the letters of both lists, separated by tabs.