Advertisement
Fhernd

comprobacion-cadenas-comodines.py

Apr 10th, 2018
2,382
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. from fnmatch import fnmatch, fnmatchcase
  2.  
  3. print(fnmatch('usuarios.txt', '*.txt'))
  4. print(fnmatch('usuarios.txt', 'usuari??.txt'))
  5. print(fnmatch('Datos2017.csv', 'Datos[0-9]*'))
  6.  
  7. archivos = ['Datos2017.csv', 'Datos1999.csv', 'init.json', 'parser.py']
  8.  
  9. print([archivo for archivo in archivos if fnmatch(archivo, 'Datos[0-9]*.csv')])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement