Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created July 14, 2018 12:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/6c8e2f06865432e5fc93bbfeb34b9e2a to your computer and use it in GitHub Desktop.
Save Fhernd/6c8e2f06865432e5fc93bbfeb34b9e2a to your computer and use it in GitHub Desktop.
Comprobar la existencia de un archivo o carpeta. OrtizOL.
import os
# Comprobar existencia carpeta Windows:
print(os.path.exists('C:\\Windows'))
# Comprueba si un archivo existe:
print(os.path.exists('C:\\com.bat'))
# Determinación de tipo de recurso:
print(os.path.isdir('C:\\Windows'))
print(os.path.isfile('C:\\Windows\explorer.exe'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment