mesh = open('file.mesh', 'r')
with open('p2t.txt', 'w') as f:
    for line in mesh:
        line = line.replace('[', '{').replace(']', '}').replace('}{', '},{')
line = '{' + line + '}'
f.write(line)
Python - Opening and changing large text files