12-1-2 output.txt problems!


#1



So first, python says to me that output.txt doesn't exist.
So i put a little code to create it.
After, python says to me that mon_fichier doesn't look like a file.
What the ■■■■?
Can someone help me to unlock this exercice please...


https://www.codecademy.com/fr/courses/python-intermediate-fr-FR-i3pwf/0/2?curriculum_id=5370f030fed2a866a2000001


Oups, merci de réessayer. Il semblerait que mon_fichier ne soit pas un fichier.


import os


if os.path.exists('output.txt'):
    print "File exists"
else:
    variable = open("output.txt", 'w')
    variable.write("I'm the first line of the file!" +"\n")
    variable.close()

my_file = open("output.txt", "r+")


#2

ok i found in the forum, thanks


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.