my code is not showing any output after running specific commands for reading a file from storage location. I'm still a beginner so i'm little confused. Dropping my code here below
CodePudding user response:
You are not reading the file your code, hence it does not show any output.
Try this
path = <path of you file>
file = open(path, mode="r")
file.read()
file.close()
You can also simplify it further
with open(path, mode="r") as file:
file.read()
CodePudding user response:
If you want to display the output of an executed cell, you should execute the variable you want to inspect in a different cell (or at the end of a cell). It wont work if it is inside the context manager (with clause).
[1] with open(path, mode="r") as file:
content = file.read()
[2] content