Let's say I have a str
of length 5: Hello
. If I wanted to iterate through every character from index 1
on, I'd do it like this:
s = 'Hello'
for c in s[1:]:
# do something
Does looping like this create a new str
object of length 4? I can see it being very memory inefficient with bigger strings...