當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python matplotlib flatten用法及代碼示例

本文簡要介紹 python 語言中 matplotlib.cbook.flatten 的用法。

用法

matplotlib.cbook.flatten(seq, scalarp=<function is_scalar_or_string>)

返回扁平嵌套容器的生成器。

例如:

>>> from matplotlib.cbook import flatten
>>> l = (('John', ['Hunter']), (1, 23), [[([42, (5, 23)], )]])
>>> print(list(flatten(l)))
['John', 'Hunter', 1, 23, 42, 5, 23]

作者:Holger Krekel 和 Luther Blissett 的合成來自:https://code.activestate.com/recipes/121294/ 和食譜中的食譜 1.12

相關用法


注:本文由純淨天空篩選整理自skytowner.com大神的英文原創作品 matplotlib.cbook.flatten。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。