I have a list of lists in python looking like this:
[['a', 'b'], ['c', 'd']]
I want to come up with a string like this:
a,b;c,d
So the lists should be separated with a ;
and the values of the same list should be separated with a ,
So far I tried ','.join([y for x in test for y in x])
which returns a,b,c,d
. Not quite there, yet, as you can see.
";".join([','.join(x) for x in a])
>>> ';'.join(','.join(x) for x in [['a', 'b'], ['c', 'd']])
'a,b;c,d'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With