Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Concatenate strings in all combinations
import itertools
['%s%s' % (x, y) for x, y in itertools.product(['a', 'b'], ['1', '2'])]
# ['a1', 'a2', 'b1', 'b2']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.