Q:

Getting last element of a nested list in Django template?

I got a list in my template which is something like :
[[('a', 'b', 'c')], ['d', 'e', 'f'], ['g', 'h', 'i']] (but the list length is not always the same)
I want to access 2 elements from this list:

The first element of the first sublist (here it's 'a'). Easy : {{ the_list.0.0 }}
The first element of the last sublist (here it's 'g'). How to do this? 

I tried {{ the_list|last.0 }}but it does not work.
Thanks.

A:

I dit it with a custom tag.
If there is not another way, I'll mark this as right answer.
@register.filter
def first_of_last_sublist(input_list):
    try:
        return input_list[-1][0]
    except:
        return input_list

