In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
How to print out python's current global variables and entry parameters of all the properties, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can get something.
Def cndebug (obj=False):
"
Author: Nemon
Update: 2009.7.1
TO use: cndebug (obj) or cndebug () or MyObject.debug=cndebug
License: GPL
"
Print ('= * 80)
Print ('='* 30 + 'GLOBAL VARIABLES' +'='* 30)
Print ('= * 80)
G=globals ()
For xrecoy in g.iteritems ():
If x [: 1]! ='_':
Print (x +': ='+ str (type (y)
Print (y)
Print ('')
If obj:
Print ('= * 80)
Print ('='* 30 + 'LOCAL VARIABLES' +'='* 30)
Print ('= * 80)
For o in dir (obj):
# if o [: 1]! ='_':
Print (o +': ='+ str (type (getattr (obj,o)
Print (getattr (obj,o))
Print ('')
Print ('= * 80)
O=raw_input ('PRESS TO RESUME...')
Del x,y,o
Simple usage:
1) print out the current global variable of python
Cndebug () #
2) print out all the properties of the current global variable and myobj
Myobj= {}
Cndebug (myobj)
Extended usage-print the members of the instance as a class method
> class MyObj ():
... Debug=cndebug
...
> > myObj1=MyObj ()
> > myObj1.debug ()
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.