Attribute | Meaning | |
---|---|---|
__doc__ |
The function’s documentationstring, or None ifunavailable; not inherited bysubclasses |
Writable |
__name__ |
The function’s name | Writable |
__qualname__ |
The function’squalified name New in version 3.3. |
Writable |
__module__ |
The name of the module thefunction was defined in, orNone if unavailable. |
Writable |
__defaults__ |
A tuple containing defaultargument values for thosearguments that have defaults,or None if no argumentshave a default value |
Writable |
__code__ |
The code object representingthe compiled function body. | Writable |
__globals__ |
A reference to the dictionarythat holds the function’sglobal variables — theglobal namespace of themodule in which the functionwas defined. | Read-only |
__dict__ |
The namespace supportingarbitrary functionattributes. | Writable |
__closure__ |
None or a tuple of cellsthat contain bindings for thefunction’s free variables. |
Read-only |
__annotations__ |
A dict containing annotationsof parameters. The keys ofthe dict are the parameternames, and 'return' forthe return annotation, ifprovided. |
Writable |
__kwdefaults__ |
A dict containing defaultsfor keyword-only parameters. | Writable |
获取当前的代码所在的文件名
__globals__['__file__']
D:\MARK\NOTE\temp.py