本文整理汇总了Python中matplotlib.cbook.listFiles方法的典型用法代码示例。如果您正苦于以下问题:Python cbook.listFiles方法的具体用法?Python cbook.listFiles怎么用?Python cbook.listFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类matplotlib.cbook
的用法示例。
在下文中一共展示了cbook.listFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OSXInstalledFonts
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import listFiles [as 别名]
def OSXInstalledFonts(directories=None, fontext='ttf'):
"""
Get list of font files on OS X - ignores font suffix by default.
"""
if directories is None:
directories = OSXFontDirectories
fontext = get_fontext_synonyms(fontext)
files = []
for path in directories:
if fontext is None:
files.extend(cbook.listFiles(path, '*'))
else:
files.extend(list_fonts(path, fontext))
return files
示例2: list_fonts
# 需要导入模块: from matplotlib import cbook [as 别名]
# 或者: from matplotlib.cbook import listFiles [as 别名]
def list_fonts(directory, extensions):
"""
Return a list of all fonts matching any of the extensions,
possibly upper-cased, found recursively under the directory.
"""
pattern = ';'.join(['*.%s;*.%s' % (ext, ext.upper())
for ext in extensions])
return cbook.listFiles(directory, pattern)