Created
June 28, 2020 06:49
-
-
Save Keiku/f2f6b73d5cccfd4a9c42b7f876ec0088 to your computer and use it in GitHub Desktop.
Concatenate strings in all combinations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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