1 2 3 4 5 6 7 8 9
import stat import os def disk_exists(path): try: return stat.S_ISBLK(os.stat(path).st_mode) except: return False