0
def set_detail_to_user(id, key, val):
    """
    Set details to id@domain by admin
    """

    tx = iroha.transaction([iroha.command('SetAccountDetail',
                account_id=id +'@' + domain_name, key=key, value=val)
            ])
    IrohaCrypto.sign_transaction(tx, ADMIN_PRIVATE_KEY)
    send_transaction_and_print_status(tx)
  • 现在我想在调用此函数时将 dict 作为 arg 传递
#now when i call the function
user = new.__id.replace('-', '')
my_dict = new.__dict__
set_detail_to_user(user,every_key_in_my_dict, every_value_in_my_dict)

任何建议请为每个键值对多次调用该函数

4

1 回答 1

0
for key, value in dict.items():
        set_detail_to_user(id, key, value)

有多种方法。你也可以通过整个字典。

于 2021-11-07T13:14:47.103 回答