Page 1 of 1

[SOLVED]List and Index

Posted: Mon Jan 20, 2020 2:02 pm
by GoldenD
is it possible to have a list i call by a personnal string index and that would look like this :

Code: Select all

define listEvents = [
["Event1", False],
["Event2", False],
["Event3", False],
.../...   
]
I would like use this list giving the string ("Event1" for example) as index, and read or append its boolean value.

Clear ?

Re: List and Index

Posted: Mon Jan 20, 2020 2:06 pm
by gas
EDIT (my bad).

That's exactly what dictionaries are made for.

Code: Select all

default mylist = {"Event1": False, "Event2": False}
and use default, not define, you want to apply some change.

Re: List and Index

Posted: Mon Jan 20, 2020 2:19 pm
by GoldenD
Hi,
and sorry.

Apparently I didn’t read the dictionaries correctly.

Thanks