Is it a good idea to dynamically create variables?

后端 未结 5 1922
故里飘歌
故里飘歌 2020-12-06 23:58

I recently found out how to dynamically create variables in python through this method:

vars()[\'my_variable\'] = \'Some Value\'

Thus creat

5条回答
  •  既然无缘
    2020-12-07 00:28

    I don't see what would be the advantage of it, also would make your code harder to understand. So no I don't think it is a good idea.

提交回复
热议问题