#nsad__
1 messages · Page 1 of 1 (latest)
Hi there! Can you share more details about what you're trying to do? I don't quite understand what you mean by "discompact"
Hello!
produtos = stripe.Product.list()
for produto in produtos:
if produto.features:
print(produto['features'])
return this:
[<StripeObject at 0x7f1dc986c360> JSON: {
"name": "envio de at\u00e9 20 emails"
}, <StripeObject at 0x7f1dc986c400> JSON: {
"name": "cria\u00e7\u00e3o de at\u00e9 20 usu\u00e1rios"
}]
how i can acess the value inside name?
What do you mean the "value"?
"envio de at\u00e9 20 emails"
In this case, you're looping through products and listing each product's feature. "envio de at\u00e9 20 emails" is a feature you've given to this product
yes, but how i can get acess to this value
i can acess using produto['feature'][0]['name']but dont return everyall
its better use metadata?
to do this?
I'm not following exactly. When looking at a Product object, its features will be a set of names: https://stripe.com/docs/api/products/object#product_object-features
There's no key:value pair, it's just single "names"
Let's take a step back. In the example above, you're listing Products and looping through each Product to retrieve its features. "envio de at\u00e9 20 emails" is one of the features. Where is the issue here?
produtos = stripe.Product.list()
for produto in produtos:
if produto.features:
print(produto['features'])
print("\n")
print(produto['features'][0]['name'])
[<StripeObject at 0x7f8b66a13b50> JSON: {
"name": "dois"
}, <StripeObject at 0x7f8b66a13bf0> JSON: {
"name": "tres"
}]
dois
[<StripeObject at 0x7f8b66850310> JSON: {
"name": "envio de at\u00e9 20 emails"
}, <StripeObject at 0x7f8b668503b0> JSON: {
"name": "cria\u00e7\u00e3o de at\u00e9 20 usu\u00e1rios"
}]
envio de até 20 emails
Because in first object, dont acess "tres", because of index, and same time happen in second object
Sorry, I'm still not sure I follow.