I am attempting to update a series of .csv files to add a missing column delimiter. However, my attempt at appending this character is generating a line break after the delimiter. I see that 'append' is designed exactly for that purpose - to append a new line to a file. Where should I be looking to accomplish this desired output:
Input:
Header|
Data
Output:
Header|
Data|
For reference I've checked several such SO questions as: How do you append to a file in Python?
Code for reference:
import os
with open("myNewFile.txt", "a+") as myfile:
myfile.write("|")
For further reference, currently my result looks like:
Header|
Data
| (with the pipe character added on a new line)