Ignoring the existence of special symbols


Does anyone know any way to make Dynamo “ignore” the existence of special symbols (“É”, “ã”, “í”, “´`~^” and so on)? Is there any node for this?

Thanks a lot,

Hello @luupieper,

This doesn’t quite solve your issue entirely - but may get you part of the way there!

'''
REMOVE SPECIAL CHARACTERS
'''

__author__ = 'Sol Amour'
__twitter__ = '@_solamour'
__version__ ='1.0.0'

# Input list from our Python IN[0] port named to 'elements'
elements = IN[0]

# Check input is list or not - Make into list if needed
if not isinstance(elements, list):
    elements = [elements]

# Creating an empty results list which will collect our output
results = []

# Running a 'For loop' over each item in our list
for item in elements:
    # For each item in our list, check if each character is Alphanumeric or not and removing if false
    results.append(''.join(e for e in item if e.isalnum()))

# Returning our results
OUT = results
3 Likes

There’s a nice Python module called “Unidecode” that would actually convert those characters to the closest letter in the alphabet, but if you just want to replace them with something you could simply use a regular expression.

2 Likes

Thanks for the answers! I thought there was a node that did this :confused:. Well, okay, I’ll try it in the ways suggested above.

Thanks a lot