President Obama has spoken about the shooting of three police officers in Baton Rouge, Louisiana.