Incrementing a string

Duncan Booth duncan.booth at invalid.invalid
Thu Sep 16 10:38:06 CEST 2004


Jeffrey Froman wrote:

> import string
> 
> def strpp(s):
>     for i in s:
>         yield i
>     for i in strpp(s):
>         for j in s:
>             yield i + j
> 
> labels = strpp(string.lowercase)
> label = label.next() # ad infinitum
> 
> 

string.ascii_lowercase may be preferable here.



More information about the Python-list mailing list