So I have a list that can contain numbers and letters which are strings. On each routine this list needs to be incremented by 1, Example 1-2, 47-48, A-B and G-H. I can get it work by turning strings to numbers, +1 them in a code block then convert back to a string to populate the parameter. I can’t figure out how to do this with letters.
Has anyone come across something like this before?
A bit of googling brought me this. Maybe take a look at it and give it a shot.
Hello try this Python script
lst_toIncr = IN[0] #input value must be a string's list digit or alpha
out = []
for val in lst_toIncr:
if val.isdigit():
out.append(str(int(val) + 1))
else:
out.append(chr(ord(val) + 1))
OUT = out
Cheers for that, this worked for what I need.
Cheers again Jacob, this works on the newer version of Dynamo but this script sometimes has to work on Dynamo 1.3. Ill use this on projects post 2018.
Ah, the horrors of the old versions. 2017 and up should support 2.0.4 though which might save you some coding time and package management and calculation times. Worth a consideration, but glad you’re sorted out either way. ![]()

