I am trying to concatenate a group of fields, but there are some non-nullable entries that contain a single space.
This is an example of the setup I made in excel, and example results are in the "RESULT" field. The results I want but can't figure out are in the "DESIRED RESULT" field. Basically just to remove all the weird spaces put in by the non-nullable fields.
I am currently trying this code:
" ".join([str(i) for i in [ !STREET_NUM!, !PREDIR!, !PRETYPE!, !NAME!,!TYPE!, !SUFDIR!, !UNIT_TYPE!, !UNIT_NUM!] if i])
However, I think it is picking up the spaces as filled boxes within the program and spitting them out as double spaces in the final result. I can't figure out how to resolve this so it gives me the desired result.
It's also not an option to nullify those fields.
Any ideas? Thanks in advance.
Solved! Go to Solution.
Hi @FionaHayward,
My hunch is that there is either a space in one of the values in the list of values or there is a trailing space at the end of one of the non-empty values.
Try going through and using the <string_value>.strip() method to remove any spaces.
Hi @FionaHayward,
My hunch is that there is either a space in one of the values in the list of values or there is a trailing space at the end of one of the non-empty values.
Try going through and using the <string_value>.strip() method to remove any spaces.
This worked! Thank you!!