myString = '123_456' print myString.split('_')[1] --- you get '456'