+ 1
After
When I run the following, I get "NONE" instead of the amount of bytes in the file that was written. msg = "Hello everyone!" file = open("//Users/michaelking/Downloads/helloworld3.html","w") amount_written = file.write(msg) print(amount_written) file.close() WHY do I get NONE? It should Be 15
6 odpowiedzi
+ 4
When i remove the path you are using and only keep the file name, the code works ok for me as expected. Have you done this try already?
'None' means, that the system can not write to the file. Do you have the permission to write to that location?
+ 3
Lothar
ahhh thanks😀😀
+ 3
I did a try with iOS on Apple and on Windows 10. On both systems the code writes the string to the file and returns the number of bytes written.
+ 2
I have successfully written "Hello everyone" to the specified file. But in the exercise on SoloLearn, they print the number of bytes that was written.
+ 1
15?????