Quantcast
Channel: How do I check whether a file exists without exceptions? - Stack Overflow
Viewing all articles
Browse latest Browse all 46

Answer by durjoy for How do I check whether a file exists without exceptions?

$
0
0

If you imported NumPy already for other purposes then there is no need to import other libraries like pathlib, os, paths, etc.

import numpy as npnp.DataSource().exists("path/to/your/file")

This will return true or false based on its existence.


Viewing all articles
Browse latest Browse all 46

Trending Articles