You entered the number 0. changeNum - 1 will be -1.
tried it again but chose 1
As I have stated, I am new to Python but I am an expert programmer. So I looked up.
I think you are correct about the append part.
Test to see if the file is new. If so, do open(MyFile, “a”)
I think this is it.
With file access mode ‘a’, open() function first checks if file exists or not. If the file doesn’t exist, then it creates an empty file and opens it. Whereas, if the file already exists then it opens it. In both cases, it returns a file object, and it has write cursor, which points to the end of the opened file. Now, if you write anything to the file using this file object, then it will be appended to the end.
Thank you, where would you recommend i place this in my code, I am only a novice at this. It took me a week just to get it to make a new file LOL
Just installed Python for Windows. Lets see what it does.
Check to see if there’s 0 or 1 line in the file.
in the existing test.txt there’s 1 but in the newly created one that the program asks if we want it creating there is 0 even after it asks if you want to edit a line. I think the problem is is that there is nothing in the new file to edit?
I think I know what I need to do but I am unsure on how to do it somewhere in this section I need to add code that asks to add information to the new file?
What compiler/interpreter do you use? The other ones kept giving me errors. And yes I know I am new to Python, but I am an experienced computer programmer. LOL
it sort of gives you a helping hand
I have to start learning PHP next, I can just about use Python!
Which one? Professional or Community?
the Community one
I’m sorry. I am installing it finally. It’s, uh, New Year. You understand? Heh.
yeah I was feeling it earlier but a couple of coffees later im ok now!
While I am waiting for it to complete the download drunkly, Does the empty file means 0 and one line means 1?
ChangeNum = 0 or 1.
I think i have sorted it out, maybe not the best way i could of cheated i dont know? when it creates the new file i have it write hello world into it so then i just edit that first line! not sure if this is good
Why not? That would make it a joke. LOL.