#neil3rd-python-index

1 messages · Page 1 of 1 (latest)

lean flower
#

Hi 👋 can you elaborate?

muted tulip
#

Hello

#

when executing stripe.Customer.list

#

along with

#

customers.data[0].name

#

I get the error >>> IndexError: list index out of range

lean flower
#

How are you using customers.data[0].name?

muted tulip
#

This is the way I am using it

lean flower
#

Have you confirmed the data array is populated with any customers?

muted tulip
#

how do I confirm?

lean flower
#

You can check its length, or just print its contents.

muted tulip
#

excluding print, how do I check via its length?

lean flower
muted tulip
#

copy on this

#

last question before this thread can be achieved

#

this is a valid code >>> customers.data[0].balance

#

right?

lean flower
#

Looks to be (assuming we're still talking about the same scenario)

muted tulip
#

yes same scenario

#

thank you, I'll exit for now