You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fnmatch is a python standard library tool which provides unix style wildcard pattern matching. Not as powerful as regex of course but for just matching with * it should be sufficient.
Example for finding all .csv files in a folder:
import fnmatch
import os
for file in os.listdir('.'):
if fnmatch.fnmatch(file, '*.csv'):
print(file)
This could replace using regex per default for the pyam filter function.
The text was updated successfully, but these errors were encountered:
Thanks for the suggestion @phackstock - this could be a nice way to get rid of the utils function _escape_regexp() within pattern_match() (for the non-regexp use case) , which seems to be doing pretty much the same thing...
I reverted the previous PR in #699, because fnmatch does not natively support filtering lists, using the pyam function pattern_match() directly was an easier fix. fnmatch might still be a useful option within pattern_match().
Looked at this again as a possible improvement to #849, but this package also has issues with square brackets and would require some customization... See https://docs.python.org/3/library/fnmatch.html
Fnmatch is a python standard library tool which provides unix style wildcard pattern matching. Not as powerful as regex of course but for just matching with
*
it should be sufficient.Example for finding all
.csv
files in a folder:This could replace using regex per default for the pyam filter function.
The text was updated successfully, but these errors were encountered: