'How to add multiple lists to a variable in order

[templatetag.py]

@register.filter
def after_teacher(value):
    split_teacher = re.split('[ -> |/]', value)
    return split_teacher [len(split_teacher ) - split_teacher [::-1].index(''):]

@register.filter
def compare_teacher(v1, v2):
    for diff in difflib.unified_diff(v1, v2):
        return diff

[statistic.html]

{% for h in educate.history %}
     {% if h.summary_json.field_summary.teacher|length > 0 %}
       {{ h.summary_json.field_summary.teacher|after_teacher }} -> I'm going to add the compare_teacher template tag: {{ h.summary_json.field_summary.teacher|after_teacher}}
     {% endif %}
   {% endfor %}

The output of html is as follows. ['Halen', 'Lisa'] ['Halen', 'Kenji'] ['Halen'] ['Halen', 'Kenji'] ['who']

I want to apply the "compare_teacher" template tag to this result(multiple list). I need two variables and I want to compare them in the order of the list. index 0 list, index 1 list and index 1 list, index 2 list and index 2 list, index 3 list and index 3 list, index 4 list and index 4 list, index 5 list



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source