[Python] How to insert a character after every 2 characters in a string

Discussão em 'Python' iniciado por Stack, Setembro 30, 2024.

  1. Stack

    Stack Membro Participativo

    Is there a pythonic way to insert an element into every 2nd element in a string?

    I have a string: 'aabbccdd' and I want the end result to be 'aa-bb-cc-dd'.

    I am not sure how I would go about doing that.

    Continue reading...

Compartilhe esta Página