Search code examples
pythontrello

How can I print all cards from "List Done" list in Py-trello?


I have written function that returns array with all trello cards:

def get_cards_from_board(my_board_1):
    T = []
    lists = my_board_1.list_lists()
    for l in lists:
        cards = l.list_cards()
        for c in cards:
            assert isinstance(c, object)
            T.append(c)
    return T

But I want to return/print all trello cards that have been done, another words all trello cards from one list - . How can I do that ?


Solution

  • I find the answer by myself:

    def get_cards_from_board(my_board_1):
    T = []
    lists = my_board_1.list_lists()
    for l in lists:
        if l.name == 'Done':
            cards = l.list_cards()
            for c in cards:
                assert isinstance(c, object)
                T.append(c)
    return T