內置函數:abs_all_any

函數:函數

  1. abs(x) 
  2. 返回一個數的絕對值.該參數能夠是整數或浮點數.若是參數是一個複數,則返回其大小
複製代碼

代碼:code

  1. >>> abs(1)
  2. 1
  3. >>> abs(-1)
  4. 1
  5. >>>
複製代碼


===================
函數:it

  1. all(iterable)
  2. 若是迭代器裏面的任何元素都非零,返回True;不然返回False.
複製代碼

代碼:class

  1. >>> all([-1,'   ',1])
  2. True
  3. >>> all([-1,0,1])
  4. False
  5. >>> all(['  '])
  6. True
  7. >>> 
  8. >>> all([''])
  9. False
  10. >>>
複製代碼


===================

函數:迭代器

  1. any(iterable)
  2. 若是迭代器裏面的任意元素非零,返回True;不然返回False.
複製代碼

代碼:di

  1. >>> any([1,'   ',False])
  2. True
  3. >>> any(['   '])
  4. True
  5. >>> any([False])
  6. False
  7. >>> any([''])
  8. False
  9. >>>
複製代碼
相關文章
相關標籤/搜索