Posted on 23rd July 2024|18 views
How do you create a file if not exist in Python?
Posted on 23rd July 2024| views
Here is an example to check if the file exists and to create if there is no file
import os.path
file_exists = os.path.isfile(file_name)
if file_exists:
# staments
else:
# staments to create a file