1.rsplit ():P Ython string application function
1 def Load_class (s): 2 Path, Klass = S.rsplit ('. ', 1)3 __import__(path)4 mod = Sys.modules[path]5 return getattr (mod, Klass)
2.__import__ () Python built-in function that can be imported directly into the module
3.getattr:python built-in function: Used to return an object's properties or methods
1 assert Issubclass (Self.database_class, PeeWee. Database)
1.issubclass: Built-in function Issubclass (class, ClassInfo) to determine if class is ClassInfo subclass
2.assert:python's assert is used to check a condition, and if it is true, it does nothing. If it is false, it throws a Asserterror and contains an error message
1.encode: In encoding conversion, it is usually necessary to use Unicode as the intermediate encoding, that is, the other encoded strings are decoded (decode) into Unicode, and then from Unicode encoding (encode) to another encoding.
2.xrange: Similar to Range: But unlike range, which produces a list, xrange produces a generator.
So xrange do loop performance better than range, especially when returning very large, try to use Xrange bar, unless you are going to return a list
Http://ciniao.me/article.php?id=17
3.enumerate: A sequence can be generated
Python encounters (later to classify)