import reword = "string_str word"print(re.sub(r"[ ](?=[ ])",' |', word))
Standard input is empty
string_str | | | | word
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!