[英]Difficulty in understanding the python variable declaration
我是 Python 的新手,並試圖解碼一條線以移植到 Go。 在當前的 python 腳本中,我在大部分 class 下都遇到了這個聲明(dataValue)。
class Keys(object):
AB1 = 0x0FF
AB2 = 0x0A2
dataValue = {'0xffff':None}
@classmethod
def _init(cls):
for ke, vl in vars(cls).items():
試圖通過實際項目來理解這些概念。 提前致謝!
dataValue
是一個字典變量名稱,其中包含key:value
對'0xffff':None
無vars(cls).items()
Return the __dict__
attribute for a module, class, instance, or any other object with a __dict__
attribute https://docs.python.org/3/library/functions.html#vars .
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.