First, you have to enclose the letter elements in the List in single quotes, and then what you need to do is a list generation, a multi-level expression.
>>> a = ['A','B','C','D','E','F']
>>> b = ['a','b','c','d','e','f']
>>> [x+y for y in b for x in a]
['Aa', 'Ba', 'Ca', 'Da', 'Ea', 'Fa', 'Ab', 'Bb', 'Cb', 'Db', 'Eb', 'Fb', 'Ac', 'Bc', 'Cc', 'Dc', 'Ec', 'Fc', 'Ad', 'Bd', 'Cd', 'Dd', 'Ed', 'Fd', 'Ae', 'Be', 'Ce', 'De', 'Ee', 'Fe', 'Af', 'Bf', 'Cf', 'Df', 'Ef', 'Ff']
List generation can be used for operations and string concatenation Here is a detailed introduction in the document https://docs.python.org/2/tut...
First, you have to enclose the letter elements in the List in single quotes, and then what you need to do is a list generation, a multi-level expression.
List generation can be used for operations and string concatenation
Here is a detailed introduction in the document https://docs.python.org/2/tut...