Php Remove String From End Of String Variable Python