Inspect的学习笔记
Posted songyuc
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Inspect的学习笔记相关的知识,希望对你有一定的参考价值。
1 判断对象是否是Class
import inspect
import torch
a = "SGD"
print(f"<type(a).__name__ 'a'>:",inspect.isclass(a))
a = torch.optim.SGD
print(a,inspect.isclass(a))
Print:
<str ‘SGD’>: False
<class ‘torch.optim.sgd.SGD’> True
以上是关于Inspect的学习笔记的主要内容,如果未能解决你的问题,请参考以下文章
python+playwright 学习-8.如何在控制台调试定位(Inspect selectors)