mardi 2 juin 2020

How do I simplify these lines of code (python)

How do I simplify this? Thanks in advance :)

a_list = []

for a in bunch_of_As:
    if a.name == "WHATEVER":
        for msg in a:
            if msg.type == "value 1":
                a_list.append(a)
            elif msg.type == "value 2":
                if msg.time != 0:
                    do_something(a)
                a_list.remove(a)

Aucun commentaire:

Enregistrer un commentaire