US President Donald Trump praised Iran for halting what he said were plans to hang more than 800 political prisoners.