R=range r=R(34,40)+R(43,50)+R(53,60) for M in'3456789': for D in R(16,20)+R(23,30): \x09for h in R(13,20)+[23]: \x09 for m in r: \x09\x09for s in r: \x09\x09 S=M+`D`+`h`+`m`+`s` \x09\x09 if len(set(S))>8:print'0'+S
Note that non-ascii characters in the above source code will be escaped (such as \x9f).