Efficient way of generating original alphabetic strings like unix file "split"
Rob Wolfe
rw at smsnet.pl
Thu Jun 14 16:08:18 EDT 2007
py_genetic <conor.robinson at gmail.com> writes:
> 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?
You didn't try hard enough. :)
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/190465
--
HTH,
Rob
More information about the Python-list
mailing list