The %-25s
stands for a string comprising 25 spaces. It can as well be replaced with 25*" "
.
The above line of code can be written as:
a_string_of_spaces = 25*" "
X = fnmatch.fnmatchcase(filename, pattern)
print("Filename:", name, a_string_of_spaces, X)
According to the python documentation:
fnmatch.fnmatchcase(filename, pattern)
:
Test whether filename matches pattern, returning True or False; the comparison is case-sensitive and does not apply os.path.normcase()
Thus, the function parameter filename
is checked for patterns of type pattern
. The function then returns a boolean value of True
or False
So, in entirety, that line of code prints something like this (FILE_NAME
= name of the file, the pattern of PATTERN
has matched with the file):
Filename: FILE_NAME True
Hope that helps!