zoukankan      html  css  js  c++  java
  • python __builtins__ filter类 (24)

    24、'filter', 用于过滤序列,过滤掉不符合条件的元素,返回由符合条件元素组成的新列表。该接收两个参数,第一个为函数,第二个为序列,序列的每个元素作为参数传递给函数进行判,然后返回 True 或 False,最后将返回 True 的元素放到新列表中。

    class filter(object)
     |  filter(function or None, iterable) --> filter object
     |  
     |  Return an iterator yielding those items of iterable for which function(item)
     |  is true. If function is None, return the items that are true.
     |  
     |  Methods defined here:
     |  
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |  
     |  __iter__(self, /)
     |      Implement iter(self).
     |  
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |  
     |  __next__(self, /)
     |      Implement next(self).
     |  
     |  __reduce__(...)
     |      Return state information for pickling.
    

      

  • 相关阅读:
    Kattis
    Kattis
    Kattis
    Kattis -Backspace
    Kattis
    Kattis
    Kattis
    Hihocoder1061-Beautiful String
    Hihocoder1350-Binary Watch
    Hihocoder1458-Parentheses Matching(stack,vector)
  • 原文地址:https://www.cnblogs.com/gundan/p/8257176.html
Copyright © 2011-2022 走看看