What does v[] do?

image

As shown here – thank you!

1 Like

Either creating or accessing a dictionary key.

1 Like

Adding to what @info.victoromondi already said…

There is a part of the code that’s missing here, this v is a dictionary that was created in some earlier part of the code…

something like v = {}

and it already has a couple of key : value pairs:

'data' Key
'columns' Key

then the code adds a new key : value pair in v["data_as_dicts"] = []

where the key is a string "data_as_dicts" and the value is an empty list that will be filled later in the loop that comes next by the .append() Method!

Hope this helps :slight_smile:

1 Like

Here is the whole sequence I’m trying to follow (the above pasted code is from the “Looping Techniques” section, a little past the middle on the page). I’m guess v is not defined at any point until then?

I tried entering the pasted code with everything I’ve followed on that page and it returns an error saying “v” is not defined.