Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created April 10, 2018 12:51
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/696ee623ae995fb65c59add6aacec16b to your computer and use it in GitHub Desktop.
Save Fhernd/696ee623ae995fb65c59add6aacec16b to your computer and use it in GitHub Desktop.
Comprobación de cadenas de caracteres con comodines de shell. OrtizOL.
from fnmatch import fnmatch, fnmatchcase
print(fnmatch('usuarios.txt', '*.txt'))
print(fnmatch('usuarios.txt', 'usuari??.txt'))
print(fnmatch('Datos2017.csv', 'Datos[0-9]*'))
archivos = ['Datos2017.csv', 'Datos1999.csv', 'init.json', 'parser.py']
print([archivo for archivo in archivos if fnmatch(archivo, 'Datos[0-9]*.csv')])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment