You want to process a string one character at a time.
1 2 | for char in somestring:
do_something(char)
|
Because a string is a sequence type, it can be iterated over using a for loop.
Tags: shortcuts
You want to process a string one character at a time.
1 2 | for char in somestring:
do_something(char)
|
Because a string is a sequence type, it can be iterated over using a for loop.
Use map(). You can also use map:
That way you throw the for loop on a C loop, that is faster. I don't know if it will work fine with nested scopes, but should work fine.