I have a text file that has the following output after pulling information from a device:
DeviceName\n ModelName\n ModelVersion\n
I'm trying to remove the leading '\n' after each output and put in spacing between each of the specifications above but to no success. My code is as follows:
f = open(FileName, 'r')
filedata = f.read()
nremove = filedata.replace('\n', ' ')
f = open(FileName, 'w')
f.write(nremove)
f.close()
This code works for other strings I've removed in the same text file successfully, but when trying to remove the '\n', I get no success.
How can this be altered to remove from the text file?