I'm trying to write some lines in a file.
My problem arises in the output.
The code looks like this:
fileInput = open("file.txt","r+")
fileOutput = open("fileOut.txt","w")
for line in fileInput.readlines():
outputString = functionname+"="+otherfunctionname+str(lineNumber)
fileOutput.write(outputString)
fileOutput.write("\n")
The expected output:
function()=name=123
function1()=name1=1223
Instead the output looks like this:
function()
=name=123
function1()
=name1=1223
I can't figure out what is the problem. Can you give me a hint of what it could be ?
otherfunctionname? How are you creating it?functionnameends with a new line, strip that off.