I am reading dynamic data and sometimes there is text fields that contain newline characters and I would like to replace them with just a space. How would I go about this?

I am reading dynamic data and sometimes there is text fields that contain newline characters and I would like to replace them with just a space. How would I go about this?
Best answer by nielsgerrits
I think
Update: Python is still not really my thing, but I asked the AI Assist in the PythonCaller the following:
“For each feature, loop over all attributes and replace newline with space.”
It returned the following code and is works like expected.
import fme
import fmeobjects
class FeatureProcessor(object):
def input(self, feature: fmeobjects.FMEFeature):
for attr in feature.getAllAttributeNames():
value = feature.getAttribute(attr)
if isinstance(value, str):
feature.setAttribute(attr, value.replace('\n', ' '))
self.pyoutput(feature)
For bigger datasets, it would try and ignore attributes starting with “fme_” to maximise performance.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.