Write a Python program to check whether a file exists


Introduction

Write a Python program to check whether a file exists. I have used python 3.7 compiler for debugging purpose.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. import os.path
  2. open('tech.txt', 'w')
  3. print(os.path.isfile('tech.txt'))

Result

python language techstudy.org

     





Related Topics




Popular Posts