8/9 No idea

Anyone have any luck with this one?

Hi funinja, after playing with this for about 30 minutes and getting a variety of error messages, I tried changing the label “textfile” to “my_file” and it worked with no errors. The code I used is:

	my_file.write("The workaround shouldn't be necessary.")```
3 Likes

Just copied your code in script.py, works well TX. but i was wonder why we have to code something like variable.write(“str”) after to make things happen?

Try it:
with open(“text.txt”, “w”) as my_file:
my_file.write(“Helli”)
You forgot a TAB

try this
with open(“texto.txt”,“w”) as mi_archivo:
mi_archivo.write(“hola”)

try this way

from __future__ import with_statement 

with open('text.txt','w') as my_file:
    my_file.write('python')