I am trying to write a new line to a file after writing a variable. How do I do that? Here's what I have but isn't working:
abc = "Test"
myfile.write(abc\n)
You can to concatenate both strings, the one stored in the variable abc and "\n"
myfile.write(abc + "\n")
You may want to consider where the cursor is in your file_handle.
file_handle.write() will write from the beginning of the file if you've open(file, 'w') whereas file_handle.write() will add to the end (And is probably what you want) if you open(file, 'a'). Other than that, the \n in the other answers are also what you want.
abc="Test\n"