问题描述
我正在想像这样的事情……是否有一种达到类似目的的方法?这将帮助我快速学习。
import boto3
session = boto3.Session(profile_name='my-cli-profile',region_name='us-east-1')
cf = session.resource('cloudformation')
print (cf.describe_attributes())
print (cf.describe_methods())
解决方法
您可以使用标准Python的dir函数。例如:
print(dir(cf))
给出:
['Event','Stack','StackResource','StackResourceSummary','__class__','__delattr__','__dict__','__dir__','__doc__','__eq__','__format__','__ge__','__getattribute__','__gt__','__hash__','__init__','__init_subclass__','__le__','__lt__','__module__','__ne__','__new__','__reduce__','__reduce_ex__','__repr__','__setattr__','__sizeof__','__str__','__subclasshook__','__weakref__','create_stack','get_available_subresources','meta','stacks']
还有vars:
print(vars(cf))
给出:
{'meta': ResourceMeta('cloudformation',identifiers=[])}