I have a csv file where a column is filled with regex expressions.
I want to pass them into re.sub(expression, '', text) for later, but I need the string literal r'expression' rather than the string 'expression'.
Any way to do this?
Thanks
I have a csv file where a column is filled with regex expressions.
I want to pass them into re.sub(expression, '', text) for later, but I need the string literal r'expression' rather than the string 'expression'.
Any way to do this?
Thanks
If I understand well, you might want to combine double and single quotes:
rext = 'expression'
final_exp = "r'" + rext
print(final_exp)