def dot2bra(path): if '"' in path: return path path = '["' + ( path.replace('].',']["').replace('.','"]["').replace('[','"][') + '"]' ).replace(']"]',']') return path.replace('[""]','')