Why uses libraries?
Libraries can increase reusability of code. The common api can increase compatibility of program. Without library, users have to pay attention to bottom operations and too busy to realize their own logics.
The built-in practical micro-python libraries solve the problem mentioned above, users can download them directly by dragging.
To use the library more convenient, all libraries have been putted to lib catalog.
The following practical example will show you how to use the library.
Create a lib object in the root object, programing testlib.py to the lib object.
testlib.py code shown as below:
class base: def __init__(self, value): self.value = value print("base value=%d"%self.value) def getValue(self): return self.value def func(): print("testlib func is called!")
Programing and running testlib.py in the root object.
import testlib print(dir(testlib)) testlib.func() x=testlib.base(5) print(x.getValue())