If you want to copy all key / value pairs from profile
to attributes in self
, you can use the following:
self.__dict__.update(profile)
If there are some elements in the profile
that you do not want to copy, you can use the following:
for attr in ("video_codec", "resolution_width", "resolution_height", "video_bitrate", "ratio", "profile", "audio_codec", "audio_channels", "audio_bitrate"): if attr in profile: setattr(self, attr, profile[attr])
source share