Python standard library: built-in function isinstance (object, classinfo), what does classinfo mean
This function is used to determine whether the object of an object is an instance of the classinfo class. If so, True is returned; otherwise, False is returned. The classinfo parameter can be of the type, tuple, dict, or list type.
Example:
# Isinstance () cla
Python standard library: built-in functions staticmethod (function), pythonstaticmethod
This function is a static function object. It is mainly used as a modifier for static functions. Static functions can be accessed directly through the class namespace, that is, they can also be used without defining class instances. They can also be accessed through class ins
Python standard library: built-in functions: memoryview (obj), pythonmemoryview
This function returns the object obj's memory view object. The so-called memory viewing object is the object that complies with the buffer protocol. In order to use the data in the buffer for other code, you can directly use it without having to copy it.
Example:
# Memoryview ()
Python standard library: built-in functions: next (iterator [, default]), pythoniterator
This function returns the values of the next element of an iteration. It is implemented by calling the _ next _ () method. If the default parameter is set, if the next element does not exist, the value of the default parameter is returned. Otherwise, a StopIteration exceptio
Python standard library: built-in function pow (x, y [, z]), pythonpow
This function is used to calculate the yth power of x. If z exists, modulo the result. The result is equivalent to pow (x, y) % z. Pow (x, y) is equivalent to x ** y. The calculation method is used together to improve the computing efficiency. The three parameters must be numerical values.
E
Python standard library: built-in function enumerate (iterable, start = 0), enumerateiterable
This function converts an Iterated object to an enumerated object. Iterable is an iterative parameter, such as a list, array, or dictionary object. start is the start value of enumeration. The default value is from 0. The implementation principle of this function is as f
Python standard library: built-in function zip (* iterables), pythoniterables
This function is used to generate a list of tuples from multiple sequences for iterative sub-return, that is, to obtain an item from each sequence, and then generate all the items into tuples, and then generate a list of these tuples. If there are multiple sequences, use the shortest s
Python standard library: built-in function getattr (object, name [, default]), pythongetattr
This function is used to obtain the attributes of the object. The attributes are represented by the name, which is the string of the attribute name. The default parameter is an optional parameter. If the property of the retrieved object does not exist, this value is retu
This article mainly introduces the built-in function complex in the Python standard library. This article first explains the role and usage of complex, and then provides examples, you can refer to this function to create a plural number using the real + imag * j parameter. You can also convert the number of a string to the plural value, or convert a number to the
Getpass ModuleThe Getpass module provides a platform-independent way to enter passwords at the command line.Getpass (Prompt) displays a prompt string, turns off screen feedback on the keyboard, and then reads the password.If the hint argument is omitted, then it will print "Password:".GetUser () Gets the current user name, if possible.Using the Getpass module1 Import Getpass 2 3 usr = getpass.getuser ()4 pwd = Getpass.getpass (" % usr") /c10>5print usr, pwd67 for user Mulder: 8 Mulder trustno1
Python standard library notes (5)-sched module, pythonschedEvent Scheduling
schedThe module content is very simple and only defines one class. It is used as the most common event scheduling module.
class sched.scheduler(timefunc, delayfunc)This class defines a common interface for scheduling events. It requires two parameters to be passed in externally,timefu
Calling the Sys moduleImport SysPrint Sys.argv[1] #argv后跟的数字代表输出的参数位置, special case: [0] output itself, for example 13sys.pyCMD environment pass parameters to module, Python 13sys.py 677 "88"The information passed must be separated by a space650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M00/7E/D9/wKioL1cLGFKjJ9ckAAFwpbKEQaE882.png "title=" QQ picture 20160411111743.png "alt=" Wkiol1clgfkjj9ckaafwpbkeqae882.png "/>#sys模块Import SysPrint Sys.ver
Python standard library: built-in function hasattr (object, name)
This function is used to determine whether the object property (name) exists. If the property (name indicates) exists, True is returned; otherwise, False is returned. The parameter object is an object, and the parameter name is a string representation of an attribute.
Example:
# Hasattr () cla
Python standard library: built-in function eval (expression, globals = None, locals = None)
This function is a string used to dynamically execute an expression or a code object compiled by the compile function. The expression parameter is an expression string or the name of the compiled code object. The globals parameter is a global namespace and can be used to s
Chapter 1th Text 12nd. Data Structure 55The 3rd Chapter algorithm 103Chapter 4th date and Time 138The 5th Chapter Mathematics Calculation 1576th. Document System 1977th Data Persistent storage and exchange 2678th. Data compression and archiving 3409th Encryption 378Chapter 10th process and thread 38711th. Network communication 45212th Chapter internet51413th Chapter email58714th Application Building Module 623Chapter 15th internationalization and Localization 729The 16th Chapter development tool
Returns a string representing the number of parameters I represent. For example,CHR returns the character "a". the valid range of parameters I is 0 to 1. 111(0x10ffff), the value of the other range throws an exception ValueError. The inverse function of the conversion is Ord (), which converts a string into a numeric value. Examples:#chr () function print (' 0x5a: ', Chr (0x5a), ' : ', Chr, ' : ', Chr (60))The output results are as follows:0x5a:z 97:a: Cai Junsheng qq:9073204 Shenzhen
Returns the absolute value of a number.The parameters can be integers or floating-point numbers. Assuming that the parameter is a complex number, the modulus of the plural is returned.So the point of attention of the abs () function is that the plural is calculated differently. Examples:#正整数print (' ABS (1): ', ABS (1)) #负整数print (' Abs ( -1): ', ABS ( -1)) #负浮点数print (' Abs ( -10.5): ', ABS ( -10.5)) #复数print (' Abs (3+4j ): ', ABS (3+4J))The output results are as follows:ABS (1): 1ABS (-1): 1A
)
Sk.bind (Address)
Sk.listen (5)
CONN,ADDR = Sk.accept ()
Print (SK)
Print (conn)
Print (addr)
Output Result:
(' 127.0.0.1 ', 35066)
Copy Code 5.recv ()SK.RECV (bufsize)Receive data. Where bufsize represents the maximum amount of data that can be received.6.connect ()Sk.connect (Address)Connect the socket to the specified address. Address is represented by a tuple.7.send ()Sk.send (data)Send data to the connected socket.8.sendall ()Like send, the i
Type (object)Type (name, bases, Dict)This function is the type object that returns the object. Returns the object's type object directly when there is only one parameter object. Assume that you want to infer whether an object belongs to an object of a class. The ability to use the isinstance () function does not require this function to return a type object to infer. Because it does not return the type object of the base class when there is an inheritance relationship. When there are three para
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.