Earlier today I needed to iterate over a string 2 characters at a time for parsing a string formatted like \"+c-R+D-E\" (there are a few extra letters).
\"+c-R+D-E\"
Maybe not the most efficient, but if you like regexes...
import re s = "+c-R+D-e" for op, code in re.findall('(.)(.)', s): print op, code