python - python - 在Twilio Notify API中,无法发送多个SMS

我也建议你使用python JSON库来构建JSON。

测试代码:


import json


addresses = ["+1234567891","+2345869473"]


to_bindings = json.dumps([dict(binding_type="sms", address=addr) for addr in addresses])



print("'{}'".format(to_bindings))



结果:


'[{"binding_type":"sms","address":"+1234567891"}, {"binding_type":"sms","address":"+2345869473"}]'



...