[closed] syntax to append data to textfile
Posted: Tuesday 07 March 2023 23:20
I am struggeling to get data append to existing textfile
I borrowed this code partly from a script written by Waaren. It was understood thet the w+ should open the file in append mode.
But every time there is only the new data in the file gas.txt
Where is my error? And where can I find info re create a file if not already exist? To my knowledge quit native but the syntax.....
Thanks
-Bart
Code: Select all
file = io.open("/home/pi/gas.txt", "w+")
file:write("gasstand"..gasstand.."\n")
file:close() --closes the open fileBut every time there is only the new data in the file gas.txt
Where is my error? And where can I find info re create a file if not already exist? To my knowledge quit native but the syntax.....
Thanks
-Bart