Original Post
I've written parsers in C before that would do something like this:
char* str = "Hello {{name}}";
for(int i=0; i<strlen(str); ++i) {
if(str == '{') {
if(str[i+1] == '{') {
i++;
do_something();
}
}
}
So it ends up skipping over that second character when the for loop iteration var is incremented. I'm trying to do something similar in python, but obviously it's not working because of the way I'm doing the loop over the list:
str = "Hello {{name}}"
for i in range(len(str)):
if str == '{':
if str[i+1] == '{':
i += 1
do_something()
Is there a way to make this work? Thanks in advance.