Objects in object (OOP) are a very important point of knowledge that we can simply think of as data and a collection of methods for accessing and manipulating the data. After learning a function, we know that if you reuse code, why use a class instead of a function?Class has some of the advantages
1, the Class object is polymorphic: that is, multiple forms, whic
To create an instance of a class in Python, you must first import the class or the module to which the class belongs. For example:
Import mymodule
Myobject = mymodule. myclass ()
Or
From mymodule import myclass
Myobject = myclass ()
If you want to dynamically create a class
1 constant definitions (const needs to be created by formation method)Class _const (object): class Consterror (TypeError):p the "__setattr__" (Self, Name, value): if self.__ Dict__.has_key (name): raise self. Consterror, "Can ' t rebind const (%s)"%name self.__dict__[name]=value def __delattr__ (self, name): if Name In self.__dict__: raise self. Conste
The remainder of this project is mainly used urllib and LinePlot. What is urllib? the upper interface provided by the Urllib module allows us to read data on www and ftp as if it were a local file . Look at the code:Import urllib print urllib.urlopen (' http://www.baidu.com '). Read ()Execution effect:The key point to note is the urlopen function: Some examples of use of urlopen can be found in the links:http://blog.csdn.net/leer168/article/details/8643103What is LinePlot? LinePlot is a
= [row[2]-40 for row in data] , the feeling is that it can generate a List ? The code tries:L = [(n), (3,4), (5,6), (7,8)]b = [r[1] for R in L]print bThat is, the r[1 of each element r in L is added to b . Execution Result:It turns out that's almost what it means.Next look at the zip functionThe function of the zip function on the Internet is to accept any number of sequences (including 0 and 1 ) as parameters, returning a Tuple list. Under direct c
toggle-button (checkbox/radio) is checked. Fails if the specified element doesn' t exist or isn' t a toggle-button.
Get_alert (): Retrieves the message of a JavaScript alert generated during the previous action, or fail if there were no alerts. getting an alert has the same effect as manually clicking OK. if an alert is generated but you do not consume it with getAlert, the next Selenium action will fail. under Selenium, JavaScript alerts will NOT pop up a visible alert dialog.
As written in
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.