以前我静态地初始化过。这很好用
dict = {
'telco_recharge_non_wallet': {
'robi_at' : telco_recharge_non_wallet['robi_at'],
'tt' : telco_recharge_non_wallet['tt'],
'bl' : telco_recharge_non_wallet['bl'],
'gp' : telco_recharge_non_wallet['gp'],
}
}
我想要这个。(我试过了,但解决不了。)
for tel in telcos:
dict['telco_recharge_non_wallet'] = {
tel : telco_recharge_non_wallet[tel]
}
问题是我无法附加dict of dict。我尝试的方法只是获取最后插入的值
输入:print(dict['telco_recharge_non_wallet'])
输出:
{'robi_at': [['xxx', Decimal('000')], ['xxx', Decimal('000')]]}
{'tt': [['xxx', Decimal('000')], ['xxx', Decimal('000')]]}
{'bl': [['xxx', Decimal('000')], ['xxx', Decimal('000')]]}
{'gp': [['xxx', Decimal('000')], ['xxx', Decimal('000')]]}
试试这个:
您的问题和代码存在一些问题
提问前请先阅读how to ask
也许你在找这个:
相关问题 更多 >
编程相关推荐