Odinga, 65, planted a commemorative tree and gave a brief speech outside the hospital, thanking doctors, his family and the general public for their support.
The operation forced Odinga to break off the campaign for a new constitution being carried out by the grand coalition government he leads with President Mwai Kibaki. They are pushing for a yes vote in an August 4 referendum.
Newspapers said Odinga was expected to rest at home for two weeks before returning to work.
Opinion polls have indicated the draft constitution, whose passage is seen as important for investor confidence, is likely to win broad approval, but political observers say the campaign against the draft has been gaining ground in recent weeks.
The “no” campaign is led by Higher Education Minister Willian Ruto, several MPs and church leaders who are opposed to the entrenchment of Muslim kadhi courts in the draft and a clause allowing abortion under certain circumstances. Reuters