+ 1

file access

I cant pass the Boolean value and the mode value as well, to printed them at my file. P1 = open("logfile.txt", "a+") P1.write(P1.name) P1.write("\nThe file closed is :" + str(P1.closed)) if P1.closed: print("yes") else: print("false") P1.write(P1.mode)

8th Mar 2017, 1:09 PM
Efraim Ié
Efraim Ié - avatar
1 Réponse
0
why not convert them to strings first? P1.write(str(P1.mode))
26th Mar 2017, 1:01 PM
Sailesh Kumar
Sailesh Kumar - avatar