You haven't really said much about what sort of random string you need. But in any case, you should look into the random
module.
A very simple solution is pasted below.
import random
def randstring(length=10):
valid_letters='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
return ''.join((random.choice(valid_letters) for i in xrange(length)))
print randstring()
print randstring(20)