Try this:

import random
import string
print ''.join(random.choice(string.ascii_letters + string.digits) for
letter in xrange(8))

Output:

>>> print ''.join(random.choice(string.ascii_letters + string.digits) for 
>>> letter in xrange(8))
MRWFo6Fv
>>> print ''.join(random.choice(string.ascii_letters + string.digits) for 
>>> letter in xrange(8))
yiHlYvFj
>>> print ''.join(random.choice(string.ascii_letters + string.digits) for 
>>> letter in xrange(8))
ugYaozlO


Obviously since the "sample" is so small there is a (rather large)
probability that you could get dupes, I'd suggest you increase the
length of your string in any case.

Cheers.

julio

On Apr 29, 8:29 am, Jason Brower <[email protected]> wrote:
> I want to make a unique set of chars that people can't just figure out
> what they are for.  The reason for this is to create unique barcodes for
> ticket validation when entiring a conference using my software.  This
> unique letter numb combo would be in a 2d barcode and it entered using a
> restful interface.
> I am hoping ticket validation would be with an 8 digit string and
> nametags would use something similar for their individual identification
> with a 4 digit string. Both will be turned into datamatrix codes that
> will be appended to web addresses.  For example,http://iid.me/A123a567
> orhttp://iid.me/9F4done would be for validating the ticket, the other
> would be for various perposed depending on who uses it.
> Best Regards,
> Jason Brower

Reply via email to