create dictionary from list of variables

前端 未结 6 782
暖寄归人
暖寄归人 2021-02-07 00:26

I\'m looking for a way to create dictionary without writing the key explicitly I want to create function that gets number variables, and create dictionary where the variables na

6条回答
  •  旧时难觅i
    2021-02-07 00:44

    In principle this is possible by passing variable names to function create_dict and then reaching to a caller stack frame from within create_dict function using module inspect.

提交回复
热议问题