Variable Javascript String Substring Python