0
with open("bruh.txt") as file:  

    print(file.read())
    print(file.closed)    

Output:

PS C:\\Users\\hp\\Desktop\\sss\> & C:/Users/hp/AppData/Local/Mi crosoft/WindowsApps/python3.11.exe c:/Users/hp/Desktop/sss/file.py

True

PS C:\\Users\\hp\\Desktop\\sss\>

The file is in the same folder so I don't need to list the path, I saw a video on Youtube, he wrote the same code and the content of his file was printed in the terminal

The name of the file was verified; then the path was listed. I googled the problem, but the results did not help. They assumed the file did not exist, but it did

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
lily36
  • 1
  • 1
    Hi, do you have content in the file bruh.txt ? (We never know :) ) – Paul Aug 14 '23 at 13:52
  • Please format your question title and description. It's incredibly hard to understand it – knoxgon Aug 14 '23 at 14:16
  • yes,There is content in the file. It is difficult for me to explain my problem, but there are only a few things I can say: the file content doesn't appear on the terminal; there is no error, there is a text in the file that should be printed when i run the code, thanks in advance – lily36 Aug 14 '23 at 15:34

0 Answers0