August 4th, 2016, 05:49 PM
subtraction & filewrite
I have a file that contains a number and i'm using the following code to read the number.
I want to check if the number is larger than 10000 and if true I want to subtract 100 from the 10000 & write the new number to the original file.
file = open("C:/number.txt")
(Or rather than subtract 100 from my 'file' variable then writing the new value to my file, could it be written to the file directly without storing the value in a variable first? Or could someone demenstrate both?)
Then I'd like to write a value to an ini file with the following format. (Obviously creating the ini file if it doesn't exist)
100Removed = True
I have no idea how to do this, Please can anyone help?