The substitution command replaces first part with second part s/first_part/second_part/. The 'g' flag is to apply the substitution many times for each line.
So, first substitution command replaces [|] with |, and second one {|} with newline ( \n). It is simple, isn't it?
import re
fin = open('newfile.txt','r')
fout = open('file_out.txt','w+')
for line in fin:
print(line.replace(r'[|]','|').replace(r'{|}','\n'),file=fout)
fin.close()
fout.close()