I am working to extract the twitter handle of a user from a string of text.
The text is always in this format:
SomeText (@handle)
BTW, I am running this as a step in a multi-step zap. My idea was to use python to extract everything in between the parenthesis using this code:
s = input_data['s']
return s[s.find("(")+1:s.find(")")]
I defined s in my zap per the documentation, see screen shot:
I am getting the following error:
'str' object has no attribute 'copy'
Your issue is that data returned from a Python Code step must be JSON serializable.
try this:
s = input_data['s']
return {'handle': s[s.find("(")+1:s.find(")")]}