Created
April 10, 2018 12:51
-
-
Save Fhernd/696ee623ae995fb65c59add6aacec16b to your computer and use it in GitHub Desktop.
Comprobación de cadenas de caracteres con comodines de shell. OrtizOL.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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