file access | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 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 Answer
0
why not convert them to strings first? P1.write(str(P1.mode))
26th Mar 2017, 1:01 PM
Sailesh Kumar
Sailesh Kumar - avatar