tf.io.gfile.glob | TensorFlow v2.16.1 (original) (raw)
tf.io.gfile.glob
Returns a list of files that match the given pattern(s).
View aliases
Compat aliases for migration
SeeMigration guide for more details.
tf.io.gfile.glob(
pattern
)
Used in the notebooks
Used in the tutorials |
---|
Instance Segmentation with Model Garden |
The patterns are defined as strings. Supported patterns are defined here. Note that the pattern can be a Python iteratable of string patterns.
The format definition of the pattern is:
pattern: { term }
term:
'*'
: matches any sequence of non-'/' characters'?'
: matches a single non-'/' character'[' [ '^' ] { match-list } ']'
: matches any single character (not) on the listc
: matches characterc
wherec != '*', '?', '\\', '['
'\\' c
: matches characterc
character range:
c
: matches characterc
whilec != '\\', '-', ']'
'\\' c
: matches characterc
lo '-' hi
: matches characterc
forlo <= c <= hi
Examples:
tf.io.gfile.glob("*.py")
# For example, ['__init__.py']
tf.io.gfile.glob("__init__.??")
# As above
files = {"*.py"}
the_iterator = iter(files)
tf.io.gfile.glob(the_iterator)
# As above
See the C++ function GetMatchingPaths
incore/platform/file_system.hfor implementation details.
Args | |
---|---|
pattern | string or iterable of strings. The glob pattern(s). |
Returns |
---|
A list of strings containing filenames that match the given pattern(s). |
Raises | |
---|---|
errors.OpError | If there are filesystem / directory listing errors. |
errors.NotFoundError | If pattern to be matched is an invalid directory. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.