Alphabet to Number

Hi Guys,

I am trying to create an alphabet to number list logic and met some issues.

in 1, I created something like schedule column header with all the alphabet from A…Z,AA…AZ…etc
in 2, I am searching for A,C,D,K,L but the == node only returns me the first and last character
in 3, I am using use List.AllIndicesOf node to get all the true value. However, as it failed in 2, so the returned indices are in accurate

Can anyone point me into the right way?

Thank you.

To clarify, in point 2, are you trying to return all the headers that contain A, B, C…L? If so, use String.Contains
Otherwise, tell us what is the result you want to obtain in point 2

I am working with the GetScheduleDataColumns node by BIMorph Node, and it only allows input as index. So what I wanna do is instead of me counting A=0, C=2, D=3, K = 10, L=11, I’d like to just input the alphabet of the column header.

So in point 2, I am looking to convert alphabet of the column header into its respective indices so I could feed it into the GetScheduleDataColumns node.

I have tried String.Contains and it is the same outcome as ==.

Hope I communicated my intention to you well :grinning:
Thank you.

List.IndexOf with correct lacing should return the correct value. You may need to add one to that number, as it isn’t clear what the starting value should be.

Hi @csarkitek

Try this:

1 Like

Ok, got it. Elaborating on your example, here is a way to do it:

hmm…I hope I typed it correctly, but it didnt seem to work for me. Did I miss anything out?

@csarkitek Expand the warning. What did it say?

Did you mean to add IndexOf in between here? I set the lacing to longest but didnt work either

This is what it says
Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed.
Traceback (most recent call last):
File “”, line 1, in
ImportError: No module named string

Thanks @architectcoding this works!

Alright i believe you’re using Dynamo 1.3 version. You need to define the path of the string library. Try this:

import sys
sys.path.append(r'C:\Program Files (x86)\IronPython 2.7\Lib')
import string
alphabets = list(string.ascii_uppercase)
alphabets.extend([a+b for a in alphabets for b in alphabets])
search_keys = IN[0]
result = []
for sk in search_keys:
	for idx, keys in enumerate(alphabets):
		if sk == keys:
OUT = result

Hi @Kulkul I have got a solution by using Dynamo node, however I’d still be interested to know more about python in dynamo if you would explain what can I do to fix the Python script to make it works. Thank you

1 Like

I explained it in my previous reply.

1 Like

Here is a way with Clockwork…


Seems like you’re overcomplicating, if I’ve understood clearly
Seems like List.IndexOf should suffice


Thanks for that

owhh I didnt know this node. Thank you

This seems super simple but I’m quite new to dynamo, could you please enlighten me on what is happening in the first code block? Thank you

1 Like

This is the node version of the same