Hello,
I am brand new to Python programming, but I have successfully manage to bodge together a script using my previous coding knowledge and some frantic Googling.
Part of the code appends a line of information to a local CSV file, and is shown below
Can someone please give me a similarly elegant solution to add the row to the start of the file.
Thanks muchly!
K.
I am brand new to Python programming, but I have successfully manage to bodge together a script using my previous coding knowledge and some frantic Googling.
Part of the code appends a line of information to a local CSV file, and is shown below
with open('c:\power\powerdata.csv', 'a') as csvFile: writer = csv.writer(csvFile) writer.writerow(row) csvFile.close()I really need the line to be added at the start of the file and not at the end, as this code does. This is where I am stuck. None of my Googling has given an clean solution.
Can someone please give me a similarly elegant solution to add the row to the start of the file.
Thanks muchly!
K.