#!/usr/bin/python
import random
lower_a = [\'a\', \'b\', \'c\', \'d\', \'e\', \'f\', \'g\', \'h\', \'i\', \'j\', \'k\', \'l\', \'m\', \'n\', \'o\', \'p\', \'q\', \'r
I haven't tested this, but I think the basic idea should hold. Please comment if it doesn't work and I'll debug it:
L = ['ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz', '0123456789']
def f(L, length, s=''):
print s
if len(s) == length:
print s
else:
for word in L:
for char in word:
w = word.replace(char, '')
l = L[:]
l.remove(word)
l.append(w)
f(l, length, s+char)