Facebook
From 01Kiko, 3 Weeks ago, written in Python.
Embed
Download Paste or View Raw
Hits: 101
  1. # Import the required module
  2. import os
  3.  
  4. # Specify the path to your file
  5. file_path = "/path/to/your/file.py"
  6.  
  7. # Check if the file exists
  8. if os.path.exists(file_path):
  9.     # Open the file
  10.     with open(file_path, 'r') as file:
  11.         # Read and print each line
  12.         for line in file:
  13.             print(line, end='')
  14. else:
  15.     print("The file does not exist.")
  16.