AnsweredAssumed Answered

Field calculate sequential letters

Question asked by ntirres_nps on Dec 13, 2017
Latest reply on Dec 14, 2017 by rvburton

Hello,

 

I am trying to figure out how I can use the field calculator with python to calculate sequential letters. For example, I would like "A,B,C,D....Z, AA,AB, AC...".  I did find a code that works just fine in a regular python environment but I am having a hard time incorporating it on the field calculator. 

 

excel - How to make a continuous alphabetic list python (from a-z then from aa, ab, ac etc) - Stack Overflow 

 

I tried using this as the code block:

"""

from string import ascii_lowercase
  import itertools


def iter_all_strings():
   size = 1
   while True:
      for s in itertools.product(ascii_lowercase, repeat=size):
            yield "".join(s)
        size +=1

"""

 

and  "iter_all_strings()" as the expression in the field calculator but it just gives me null values.

 

Any help would be much appreciated, thank you. 

Outcomes