In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
What is the programming method of Pythond class in the function? I believe many inexperienced people don't know what to do about it. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
How can the Pythond class be used for related purposes? This problem requires us to keep learning. Let's introduce the functional programming of the Pythond class. Only by continuous learning can we make better use of it. Python belongs to the function is programming.
Python code
Created on 2009-11-18 @ author: Administrator class MyClass (object): classdocs cl = [1 init__ 2, "5"] def _ _ init__ (selfparams): Constructor print "Constructor,..." Def te (self): print "a"''Created on 2009-11-18 @ author: Administrator class MyClass (object): classdocs cl = [1 def 2, "5"] def _ _ init__ (selfparams):' 'Constructor' print "Constructor,..." Def te (self): print "a"
Python code
Import Class1 Import Class1.py file x = Class1.MyClass () generate MyClass instance x.te () print x.cl import moa import another module print moa.__file__ print moa.__name__ try catch Catch exception try: print "-" + moa.aaa (1) except: print "Error" finally: print "finally" print moa.aaa (1) m = moa.M () import Class1 'Import Class1.py file x = Class1.MyClass () generate MyClass instance' 'x.te () print x.cl import moa' Import another module' '' print moa.__file__ print moa.__name__''try catch Catch exception''try: print "-" + moa.aaa (1) except: print "Error" finally: print "finally" print moa.aaa (1)
Import in Python is like require in Perl. After import a Python module, you can use module .function to access its functions; after require a Perl module, you can use module:: function to access its functions.
After reading the above, have you mastered the programming method of the Pythond class in the function? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
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.