On Jun 14, 1:41 pm, py_genetic <[EMAIL PROTECTED]> wrote: > Hi, > > I'm looking to generate x alphabetic strings in a list size x. This > is exactly the same output that the unix command "split" generates as > default file name output when splitting large files. > > Example: > > produce x original, but not random strings from english alphabet, all > lowercase. The length of each string and possible combinations is > dependent on x. You don't want any repeats. > > [aaa, aab, aac, aad, .... aax, ...... bbc, bbd, .... bcd] > > I'm assumming there is a slick, pythonic way of doing this, besides > writing out a beast of a looping function. I've looked around on > activestate cookbook, but have come up empty handed. Any suggestions?
If you allow numbers also, you can use Base 36: >>> import gmpy >>> int('aaa',36) 13330 >>> for n in xrange(13330,13330+1000): print gmpy.digits(n,36), aaa aab aac aad aae aaf aag aah aai aaj aak aal aam aan aao aap aaq aar aas aat aau aav aaw aax aay aaz ab0 ab1 ab2 ab3 ab4 ab5 ab6 ab7 ab8 ab9 aba abb abc abd abe abf abg abh abi abj abk abl abm abn abo abp abq abr abs abt abu abv abw abx aby abz ac0 ac1 ac2 ac3 ac4 ac5 ac6 ac7 ac8 ac9 aca acb acc acd ace acf acg ach aci acj ack acl acm acn aco acp acq acr acs act acu acv acw acx acy acz ad0 ad1 ad2 ad3 ad4 ad5 ad6 ad7 ad8 ad9 ada adb adc add ade adf adg adh adi adj adk adl adm adn ado adp adq adr ads adt adu adv adw adx ady adz ae0 ae1 ae2 ae3 ae4 ae5 ae6 ae7 ae8 ae9 aea aeb aec aed aee aef aeg aeh aei aej aek ael aem aen aeo aep ... > > Thanks, > Conor -- http://mail.python.org/mailman/listinfo/python-list