-% (levelname) s-% (message) sdatefmt=$ python simple_logging_config.py2018-01-19 21:53:46,216-simpleexample-debug-debug Message2018-01-19 21:53:46,216-simpleexample-info-info Message2018-01-19 21:53:46,216-simpleexample-warning-warn Message2018-01-19 21:53:46,216-simpleexample-error-error Message2018-01-19 21:53:46,216-simpleexample-critical-critical MessageFinally, briefly, how to summarize a module, can be described around the following three point
Python standard library: built-in functions classmethod (function), pythonclassmethod
Class functions are returned as a class method. The first parameter of a class method is to specify a class. Like a function in a class, the first parameter is to specify a class instance. The class method modifier is in the following format:
Class C:
@ Classmethod
Def f (cls, a
sysThe module is used to provide an interpreter-related action
Module Method
Explanatory notes
sys.argv
A list of command-line arguments passed to the Python script, the first element being the path of the program itself
Sys.executable
Returns the absolute path of the Python interpreter in the current system
Sys.exit ([ARG])
])%H: Hours (24-hour, [0, 23])%I: Hour (12-hour). [0, 11])%j: Number of days in the year [001,366] (the day of the current year)%m: Month ([01,12])%M: Minutes ([00,59])%p:am or PM%s: Seconds (the range is [00,61]. Why not [00, 59], reference Python manual ~_~)%u: Week in the Year of the Week of the year), Sunday as the first day of the week%w: Today in this week's days, the range is [0, 6],6 represents Sunday%W: Week of the Year (the Week of the year)
Python standard library: built-in Function format (value [, format_spec])
This function formats the value in the format of format_spec. However, the function explains that format_spec is determined by the value type. Different types have different formatting interpretations. When the format_spec parameter is null, this function is equivalent to the str (value) fu
Python standard library: Detailed description of the use of the built-in function hasattr () getattr () setattr (), hasattrgetattrHasattr (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 pa
with named', p1, True) functools.update_wrapper (p1, o.method) print (p1.__name__) print (p1.__doc__)@functools. Wraps Decoratorsdef simple_decorator (f): @functools. wraps (f) def decorated (a='decorated' , b=1): print (a, b) f (a,b =b) return return = simple_decorator (myfunc) print (wrapped.__name__) print (wrapped.__doc__) @functools. total_orderingTo add a rich comparison method to a class, the class must provide __eq__ and another rich comparison method@funct
Python standard library: built-in functions iter (object [, sentinel]), itersentinel
This function returns an iteration sub-object. When the second parameter does not exist, the parameter object should be a container that supports the iteration protocol, that is, the _ iter _ () function is defined or the sequence access protocol is supported, that is, the Objec
Python standard library: built-in functions delattr (object, name), pythondelattr
This function is used to delete attributes of an object. For example, you can use this function to delete attributes added to setattr. The parameter object is an object, and the parameter name is a string, but this string must be an object attribute. For example, delattr (x, 'test'
Python standard library: built-in functions hex (x) and pythonhex
This function is used to convert a hexadecimal string representation of an integer object, such as the 0x format. If the object is not an integer, define a method ___ index _ () to return an integer. If you want to convert the result of this function to the integer type, you must use the int () fu
Python standard library: built-in functions int (x, base = 10), pythonbase
This function converts a floating point or numeric string to an integer. If the x parameter is not a number, it must be of the string, array bytes, or bytearray type. The base parameter is the base of the string parameter. The default value 10 indicates that the base parameter is in decim
Python standard library: built-in functions help ([object]), pythonobject
This function is used to call an internal help system. It is mainly used to view functions or object usage documents in interactive mode.
Example:
Print (help ('print '))
The output is as follows:
Help on built-in function print in module builtins:
Print (...)
Print (value,..., sep = '',
Python standard library: built-in functions hash (object) and pythonhash
This function returns the object's hash value. The returned hash value is represented by an integer, which is usually used in the dictionary for quick query of key values. When the input value of the parameter object is numeric, it is calculated based on numerical values. For example, 1 and
Python standard library: built-in function str (object = '') str (object = B'', encoding = 'utf-8', errors = 'strict '), pythonstrict
This function returns a String object. The parameter object is the object to be converted, the parameter encoding is the encoding method, and errors is the error processing method.
Example:
# Str () print (str ('abc') print (s
Python standard library: built-in functions divmod (a, B), pythondivmod
This function implements dividing a by B and then returns the tuples between the operator and the remainder. If both parameters a and B are integers, integer division is adopted, and the result is equivalent to (a // B, a % B ). If a or B is a floating point number, it is equivalent to (math
Python standard library: built-in function max (iterable, * [, key, default]), pythoniterable
Max (arg1, arg2, * args [, key])
This function is an iteration object iterable to compare and find the maximum value to return. When the key parameter is not null, the function object of the key is used as the criterion for determination.
Example:
# Max () array1 =
Python standard library: built-in function filter (function, iterable), pythoniterable
This function is used to traverse all elements from an iteration object iterable. When each element is run on the function object as a parameter, the elements that are judged to be True are retained, while those that are False are skipped, that is, to filter unnecessary elemen
Python standard library: built-in Function property (fget = None, fset = None, fdel = None, doc = None), fgetfset
This function is used to set attributes of class members. The fget parameter is used to obtain the attribute value of a class member. The fset parameter is used to set the attribute value of a class member. The fdel parameter is used to delete a clas
Python standard library: built-in Function format (value [, format_spec]), pythonformat_spec
This function formats the value in the format of format_spec. However, the function explains that format_spec is determined by the value type. Different types have different formatting interpretations. When the format_spec parameter is null, this function is equivalent to
Python standard library: built-in functions frozenset ([iterable]), frozensetiterable
This function returns a frozen set. The so-called freeze means that this set can no longer add or delete any elements in the set. Therefore, the difference with set is that set can add or delete elements, but frozenset cannot. Frozenset is mainly used for fast speed and is impl
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.