Skip to content

Instantly share code, notes, and snippets.

@Keiku
Created June 28, 2020 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Keiku/f2f6b73d5cccfd4a9c42b7f876ec0088 to your computer and use it in GitHub Desktop.
Save Keiku/f2f6b73d5cccfd4a9c42b7f876ec0088 to your computer and use it in GitHub Desktop.
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