SoFunction
Updated on 2024-11-10

python method to check if a specified file exists or not

This example article describes the python method to check whether a specified file exists or not. Shared for your reference. Specifically as follows:

import os
def file_exists(file_name): 
  if (file):
    return '%s is found' % file_name
  else: 
    return '%s is missing' % file_name

I hope that what I have described in this article will help you in your Python programming.