0

I have an issue with an open file. First I need to design the name of my file, then it supposed to create a file in a block note with format .txt. Also, I have to use %less in order to print the file.

This is my code:

    def file():
       name=str(input("write the name of your file: ")) 
       content=str(input("write : "))

       with open(name+".txt" , "w") as newfile:
         newfile.write(content)
       %less name.txt

    file()
    leer_libro("name.txt") #it counts my letters of each line
LOS 4 A
  • 1
  • 1

1 Answers1

1

You must pass on an absolute path to with. Example:

with open("D:/PYTHON/03_Coding_Rule/name.txt", "a") as fi:

Please enter an absolute path

Are you having this problem?