This is my file.txt:
Egg and Bacon;
Egg, sausage and Bacon
Egg and Spam;
Spam Egg Sausage and Spam;
Egg, Bacon and Spam;
I wanna convert the newLine '\n' to ' $ '. I just used:
f = open(fileName)
text = f.read()
text = text.replace('\n',' $ ')
print(text)
This is my output:
$ Spam Egg Sausage and Spam;
and my output must be like:
Egg and Bacon; $ Egg, sausage and Bacon $ Egg ...
What am I doing wrong? I'm using #-*- encoding: utf-8 -*-
Thank you.