>>> help(sys)Help on built-in module sys:
NAMEsys
FILE(built-in)
MODULE DOCShttp://www.python.org/doc/current/lib/module-sys.html
DESCRIPTIONThis module provides access to some objects used or maintained by theinterpreter and to functions that interact strongly with the interpreter.
Dynamic objects:
argv -- command line arguments; argv[0] is the script pathname if known
from flask import Flaskfrom flask_debugtoolbar import DebugToolbarExtension
app = Flask(__name__)
# the toolbar is only enabled in debug mode:app.debug = True
# set a 'SECRET_KEY' to enable the Flask session cookiesapp.config['SECRET_KEY'] = '<replace with a secret key>'
toolbar = DebugToolbarExtension(app)
If called without an argument, return the names in the current scope.Else, return an alphabetized list of names comprising (some of) the attributesof the given object, and of attributes reachable from it.If the object supplies a method named __dir__, it will be used; otherwisethe default dir() logic is used and returns:for a module object: the module's attributes.for a class object: its attributes, and recursively the attributesof its bases.for any other object: its attributes, its class's attributes, andrecursively the attributes of its class's base classes.
help(vars)
Without arguments, equivalent to locals().With an argument, equivalent to object.__dict__.
from pprint import pprintfrom inspect import getmembersfrom types import FunctionType
def attributes(obj):disallowed_names = {name for name, value in getmembers(type(obj))if isinstance(value, FunctionType)}return {name: getattr(obj, name) for name in dir(obj)if name[0] != '_' and name not in disallowed_names and hasattr(obj, name)}
def print_attributes(obj):pprint(attributes(obj))
from types import FunctionTypefrom inspect import getmembers
def attrs(obj):disallowed_properties = {name for name, value in getmembers(type(obj))if isinstance(value, (property, FunctionType))}return {name: getattr(obj, name) for name in api(obj)if name not in disallowed_properties and hasattr(obj, name)}
def getAttributes(obj):from pprint import pprintfrom inspect import getmembersfrom types import FunctionType
def attributes(obj):disallowed_names = {name for name, value in getmembers(type(obj))if isinstance(value, FunctionType)}return {name for name in dir(obj)if name[0] != '_' and name not in disallowed_names and hasattr(obj, name)}pprint(attributes(obj))
# If core==False, ignore __k__ entriesdef obj_props(obj, core=False) -> list:assert not obj is None, f"obj must not be null (None)"_props = []_use_dir=Falsedef _add(p):if not core and p.find('__') == 0: return_props.append(p)if hasattr(obj, '__dict__'):for p in obj.__dict__.keys(): _add(p)elif hasattr(obj, '__slots__'):for p in obj.__slots__: _add(p)elif hasattr(obj, 'keys'):try:for p in obj.keys(): _add(p)except Exception as ex:_props = []_use_dir = Trueelse:_use_dir = Trueif _use_dir:# fall back to slow and steadyfor p in dir(obj):if not core and p.find('__') == 0: continuev = getattr(obj, p)v_t = type(v).__name__if v_t in ('function', 'method', 'builtin_function_or_method', 'method-wrapper'): continue_props.append(p)
return _props