1. ConfigParser format.conf [DEFAULT] conn_str = %(dbn)s://%(user)s:%(pw)s@%(host)s:%(port)s/%(db)s dbn = mysql user = root host = localhost port = 3306 [db1] user = aaa pw = ppp db = example [db2] host = 172.16.88.1 pw = www db = example readformati…
__getattr____getattr__在当前主流的Python版本中都可用,重载__getattr__方法对类及其实例未定义的属性有效.也就属性是说,如果访问的属性存在,就不会调用__getattr__方法.这个属性的存在,包括类属性和实例属性. Python官方文档的定义 Called when an attribute lookup has not found the attribute in the usual places (i.e. it is not an instance a…
abs()Return the absolute value of a number. The argument may be an integer or a floating point number.If the argument is a complex number, its magnitude is returned.返回一个数的绝对值.参数可以是整数或浮点数..如果参数是复数,则返回它的数量级. all(iterable) Return True if all elements of…
2. Built-in Functions https://docs.python.org/3.4/library/functions.html?highlight=file The Python interpreter has a number of functions and types built into it that are always available. They are listed here in alphabetical order. Built-in Funct…