Javascript Array And String Methods Python