[ACCEPTED]-pythonic way to split string into two lists-string
Accepted answer
x = ["c~d", "e~f", "g~h"]
a, b = zip(*(s.split("~") for s in x))
print a
print b
prints
('c', 'e', 'g')
('d', 'f', 'h')
0
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.