This is what I want the code to do:
string = "1+1+1"
#insert code here
output:
>>>1 + 1 + 1
Basically I’m trying to create a " " around the special characters. (In this case it’s the plus signs)
>Solution :
You’ll need to better define special characters.
But anyway the solution is to .split() the string and then .join() it like that:
my_string = "1+1+1"
delimiter = '+'
result = f' {delimiter} '.join(my_string.split(delimiter))