dimanche 1 mars 2015

how to insert characters in defined places in a python string?

what is the pythonic efficient way to insert a character every n-characters in a string? for example



ins("aabbccdd", 2, "-") => "aa-bb-cc-dd"


is there a way to do this with iterators?


Aucun commentaire:

Enregistrer un commentaire