Answers for "meaning of the file exists error"

2

check if a file exists

>>> import os
>>> os.path.isfile("d:\Package1\package1\fibo.py")
True
>>> os.path.isfile("d:/Package1/package1/fibo.py")
True
>>> os.path.isfile("d:\nonexisting.txt")
Posted by: Guest on August-25-2020
0

if file not exists

#!/bin/bash
file="/.config/backup.cfg"
if [ ! -f "$file" ]
then
    echo "$0: File '${file}' not found."
fi
Posted by: Guest on August-27-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language