def generate_chunks ( string , num_chars ) : for start in range ( 0 , len ( string ) , num_chars ) : yield string [ start : start + num_chars ]
python iterate chunks of string
Yield num_chars - character chunks from string .
def generate_chunks(string, num_chars):
    """Yield num_chars-character chunks from string."""
    for start in range(0, len(string), num_chars):
        yield string[start:start+num_chars]