how do i insert spaces into a string using the range function?
Posted
by
user1319219
on Stack Overflow
See other posts from Stack Overflow
or by user1319219
Published on 2012-04-07T15:15:16Z
Indexed on
2012/04/07
17:29 UTC
Read the original article
Hit count: 228
python
If I have a string, for example which reads: 'Hello how are you today Joe' How am I able to insert spaces into it at regular intervals? So for example I want to insert spaces into it using the range function in these steps: range(0,27,2). So it will look like this:
'He lo ho w ar e yo u to da y Jo e'
It now has a space at every 2nd index going up to it's end. How do I do this does anyone know? thanks.
© Stack Overflow or respective owner