Q:

How to create a wordlist matrix

I am looking to create a list of concatenations based off of a list of words. Say up to 10 strings and create every combination of them. For example the following list:
asdf 
1234 
jkl;

Would create:
asdf
1234
jkl;
asdf1234
asdf1234jkl;
1234jkl;asdf
etc.

Is this possible in Python? I have searched and I can't find this. What should I be searching for?

A:

Python solution
You can use a list comprehension to iterate results from itertools.permutations and utilise str.join:
from itertools import permutations

lst = ['asdf', '1234', 'jkl;']

res = [''.join(p) for i in range(1, len(lst)+1) for p in permutations(lst, i)]

print(res)

['asdf',
 '1234',
 'jkl;',
 'asdf1234',
 'asdfjkl;',
 '1234asdf',
 '1234jkl;',
 'jkl;asdf',
 'jkl;1234',
 'asdf1234jkl;',
 'asdfjkl;1234',
 '1234asdfjkl;',
 '1234jkl;asdf',
 'jkl;asdf1234',
 'jkl;1234asdf']

