Python Forum

Full Version: Print to a New Line when Appending File
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How can I force appended data to a new line when writing out to an existing file please? The first line in my output file should be 943 814 2

943 814 23560581.70300000
3560591.70300000
3560601.70300000
3560611.70300000
3560621.70300000
3560631.70300000
3560641.70300000

with open(file_ls, "w") as output:
    output.write("%d %d %d" % (np.shape(kxx)[1], np.shape(kxx)[0], collapse_steps))
    for ii in np.arange((np.shape(kxx)[1])):
            print("%.8f" % (kxx[0, ii]), file=output)