[Python] How to get everything from the list except the first element using list slicing...

Discussão em 'Python' iniciado por Stack, Junho 6, 2025.

  1. Stack

    Stack Membro Participativo

    I want to parse something like:

    list = ['A', 'B', 'C']


    And using list slicing have it return to me everything but the first index:

    ['B', 'C']


    I tried list[:-1], list[::-1], list[0:-1], etc.

    What I am doing:


    • I have a error message that has an error code in the beginning such as:

      ['226', 'Transfer', 'Complete'] and I want to just display Transfer Complete on a popup widget. I am casting to a string.

    If answer differs via Python 2.7.x and Python 3.x.x, please answer for both versions.

    Continue reading...

Compartilhe esta Página