国产chinesehdxxxx野外,国产av无码专区亚洲av琪琪,播放男人添女人下边视频,成人国产精品一区二区免费看,chinese丰满人妻videos

Python3 內(nèi)置函數(shù)

2023-04-23 15:14 更新

本節(jié)介紹了 Python3 中的內(nèi)置函數(shù)以及調(diào)試的兩種方法。

內(nèi)置函數(shù)
abs() dict() help() min() setattr()
all() dir() hex() next() slice()
any() divmod() id() object() sorted()
ascii() enumerate() input() oct() staticmethod()
bin() eval() int() open() str()
bool() exec() isinstance() ord() sum()
bytearray() filter() issubclass() pow() super()
bytes() float() iter() print() tuple()
callable() format() len() property() type()
chr() frozenset() list() range() vars()
classmethod() getattr() locals() repr() zip()
compile() globals() map() reversed() __import__()
complex() hasattr() max() round()  
delattr() hash() memoryview() set()  

Python 調(diào)試方法

1、print

print('here')
# 可以發(fā)現(xiàn)某段邏輯是否執(zhí)行
# 打印出變量的內(nèi)容

2、assert

assert false, 'blabla'
# 如果條件不成立,則打印出 'blabla' 并拋出AssertionError異常

3、debugger

可以通過 pdb、IDE 等工具進(jìn)行調(diào)試。

調(diào)試的具體方法這里不展開。

Python 中有兩個(gè)內(nèi)置方法在這里也很有幫助:

  •  locals: 執(zhí)行 locals() 之后, 返回一個(gè)字典, 包含(current scope)當(dāng)前范圍下的局部變量。
  •  globals: 執(zhí)行 globals() 之后, 返回一個(gè)字典, 包含(current scope)當(dāng)前范圍下的全局變量。


以上內(nèi)容是否對(duì)您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)