【python】lalal

來源:互聯網
上載者:User

標籤:python

#!/usr/bin/env python#-*- coding:utf-8 -*-print abs(123)  #abs(number),取絕對值print all([True,True])  #all(iterable),迴圈可迭代參數,如果每個元素都為真,那麼all的傳回值為真print all([False,True])print any([1,2,3,''])  #any(iterable),迴圈可迭代參數,只要有一個元素為真,那麼any的傳回值為真print bin(4)  #bin(number),轉化成位元print hex(4)  #hex(number),轉化為十六進位print oct(4)  #oct(number),轉化為八進位print bool()  #bool(self,x),判斷真假,把一個對象轉換成布爾值:布爾值為假的:0 None ''(Null 字元串) [](空列表) ()(空元祖) {}(空字典)print callable(111)  #callable(object),驗證一個對象可被執行print divmod(10,3)  #divmod(x,y),x除以3返回元祖(3,1)print range(1,100)print type(xrange(100))
#!/usr/bin/env python#-*- coding:utf-8 -*-#lambda運算式:對簡單函數進行簡寫f2 = lambda x,y,z:x*y*z  #f2 = lambda 形式參數:函數運算式,在這裡f2是一個函數,需要調用傳參才可以使用print f2(1,2,3)
#!/usr/bin/env python#-*- coding:utf-8 -*-#isinstance():判斷物件類型temp = '123'print isinstance(temp,str)  #temp:通過str類執行個體化出來的對象


【python】lalal

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.