Use itertools.product() :
>>> import itertools >>> map(''.join, itertools.product('ABC', repeat=3)) ['AAA', 'AAB', 'AAC', 'ABA', 'ABB', 'ABC', 'ACA', 'ACB', 'ACC', 'BAA', 'BAB', 'BAC', 'BBA', 'BBB', 'BBC', 'BCA', 'BCB', 'BCC', 'CAA', 'CAB', 'CAC', 'CBA', 'CBB', 'CBC', 'CCA', 'CCB', 'CCC']
Note that creating a list containing all the combinations is very inefficient for longer strings - iterate over them instead:
for string in itertools.imap(''.join, itertools.product('ABC', repeat=3)): print string
To get all characters and numbers, use string.uppercase + string.lowercase + string.digits .