Typescript Loop Through String In Python