How to remove spaces from all texts

rhino
grasshopper
python
unhandled

#1

Hi,
Is there a way or script to remove all spaces from all selected texts.
i need this cause when i link numbers from Rhino to Grasshopper, if the number has spaces grasshopper doesn’t recognize it.

I’m actually using Script to link numbers from Rhino to Grasshopper.

Thanks


#2

Well, in Python, it would be something like this:

txt_strings=['1 xyz 56 ','abc def   ghi','12 34 56']
stripped_strings=[txt_string.replace(" ","") for txt_string in txt_strings]
print stripped_strings

>>> ['1xyz56', 'abcdefghi', '123456']