# <editor-fold desc="折叠后要显示的内容"> class Error4Code(object): """ Error code """ SUCCESS = ('10000', u'成功') API_PARAMS_ERROR = ('10001', u'API参数缺失或错误') API_APP_VERSION_ERROR = ('10151', u'您当前的APP版本过低,需要升级版本才能继续发布房源') API_IOS_BIND_FAIL_ERROR = ('10182', u'绑定ios失败') dict_info = dict() for attr in dir(Error4Code): if not callable(getattr(Error4Code, attr)) and not attr.startswith("__"): i = getattr(Error4Code, attr) dict_info[i[0]] = i[1] print(dict_info) print(dict_info.get('10000')) # </editor-fold>
效果图:
折叠代码块快捷键: