2 open (input/output-2.open)


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



You are trying to open a file that does NOT exist.......


import os
print "==show us the existing files =="
files = [f for f in os.listdir('.') if os.path.isfile(f)]
for f in files:
    print str(f)

you will see all the existing files.....

If salida.txt does not exist
you can create the file by using

print "== if the file doesn't exist, create one =="
if os.path.exists('salida.txt'):
    print "File exists"
    print "Creating the salida.txt-file"
    my_file = open("salida.txt", 'w')
    my_file.write("I'm the first line of the file!" +"\n")
    my_file.write("I'm the second line."+"\n")
    my_file.write("Third line here, boss."+"\n")

Now you can read the file with

my_file = open("salida.txt","r")
print my_file.readline()
print my_file.readline()
print my_file.readline()



Type something in the output.txt tab and click "save & submit" it will work.


thank you i typed and the code worked