8/9 No idea


#1

Anyone have any luck with this one?


#2

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:
with open("text.txt", "w") as my_file:
my_file.write("The workaround shouldn't be necessary.")


#3

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?


#4

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


#5

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


#6

try this way

from __future__ import with_statement 
with open('text.txt','w') as my_file:
    my_file.write('python')