I have a list with entries similar to the following:
[('sw1', 'sw2'), ('sw1', 'sw3'), ('sw1', 'sw4'), ('sw2', 'sw3'), ('sw2', 'sw4'), ('sw3', 'sw4')]
I would like to convert the tuples to strings and print them on individual lines like so in order to pass them as arguments to another program:
(sw1 , sw2)\n
(sw1 , sw3)\n
(sw1 , sw4)\n
(sw2 , sw3)\n
(sw2 , sw4)\n
(sw3 , sw4)\n
I tried strip()
and split()
but those don't appear to be supported for tuples. I'm assuming I would need some regex expression to accomplish what I'm trying to do, but even then I'm not sure hot to handle the fact that a potential field separator of ,
is both within and between the tuples. Any pointers are greatly appreciated. I'm old and just trying to learn to program.