0
Please tell please!!if i write like this!! This code is also not working properly!! only Q is getting written on file earn.txt
#if i write like this!! This code is also not working properly!! #only Q is getting written on file earn.txt !! Why any other thing isn't getting attached to that file(earn.txt) with open('earn.txt', 'w') as file: a = True while a: b = input("Enter Your Name\n(Type Q to Quit)\n") if b == 'Q': break file.write(b)
3 Antworten
+ 2
Look at what b is equal to when you break from the while loop. The only place you write to the file is after the loop. Also, keep in mind that mode 'w' will overwrite the file when used.
+ 1
Thank You Guys