gaogaotiantian / objprint

A library that can print Python objects in human readable format
Apache License 2.0
510 stars 43 forks source link

大佬,objprint可以打印出函数的内容吗?类似于js中console.log()方法。 #71

Closed xuxiaobo-bobo closed 2 years ago

xuxiaobo-bobo commented 2 years ago

//JavaScript function ad(a, b) {

return a + b;

}

console.log(ad.toString())

//输出 // function ad(a, b) { // // return a + b; // }

//python def ad(a,b): return a+b print(ad)

输出

<function ad at 0x000002511B318550>

gaogaotiantian commented 2 years ago

Check inspect.getsource()