You could try using regular expressions. The stupid while
loop at the end is due to fact that I do not know how to replace overlapping matches. I would be grateful for any advice on this item.
#! /usr/bin/python3
import re
string_line = '<[2{12.5 6.0}](3 -4 5)>'
while True:
string_line, count = re.subn ('[{}<>\[\]()][{}<>\[\]()]', lambda x: '{} {}'.format (*x.group () ), string_line)
if not count: break
print (string_line)
This yields:
< [2{12.5 6.0} ] (3 -4 5) >
Basically inserting a whitespace between two following brackets. If this is not the expected behaviour please let me know the expected output.