tyraellib

useful lib created by tyrael lau


License
MulanPSL-2.0
Install
pip install tyraellib==0.5.0

Documentation

tyraellib

Personal use python common lib

dict2obj

An useful python dictionary struct to object module. Using this module, you can convert a dict to an python object, so you can access diction attribute with '.' operator.

Example:

args = {'a': 1, 'b': 2}
s = TyraelStruct(args)
print s.a   # access dict key as attribute
print s.b
s.c = "hello"   # alias value by dot operator
print s.c
s.pop('c')  # you can also pop attributes
print s.c
print s.d   # missing value will retun itself