#nsad__

1 messages · Page 1 of 1 (latest)

radiant palmBOT
dire thistle
#

Hi there! Can you share more details about what you're trying to do? I don't quite understand what you mean by "discompact"

lean plume
#

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?

dire thistle
#

What do you mean the "value"?

lean plume
#

"envio de at\u00e9 20 emails"

dire thistle
#

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

lean plume
#

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?

dire thistle
lean plume
#

so but return this for me

#

what i can do?

dire thistle
#

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?

lean plume
#
    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

dire thistle
#

Sorry, I'm still not sure I follow.