>>> s = str(hexlify(urandom(8)))[2:18] >> And your question is? > > No question just solution to get rit of b'' :) Ah. hexlify(urandom(8)).decode('ascii') Regards, Martin