marklists at mceahern.com
Mon Sep 23 19:06:34 EDT 2002
[jubafre at brturbo.com]
> i have:
> x=[['0020', '0000x9'], ['0030', '0000xa'], ['00B4', '0000x8'],
> ['0030', '0000xb'], ['00F0'], ['0001'], ['0003'], ['0005']]
> and i want:
> y=['0020', '0000x9', '0030', '0000xa', '00B4', '0000x8', '0030',
> '0000xb','00F0', '0001',
> '0003', '0005']
> how to do this?
You want to flatten a sequence. Here's a recipe that does that:
I'll leave it as an exercise for you to deal with the string type
appropriately. I think the recipe will try to flatten the string (although
I have not tested to confirm that) and that's probably not what you want.
More information about the Python-list