Traditional optimization algorithms can only optimize parameters in control laws. Machine learning method can optimize parameters and evolve satellite attitude control law automatically under certain criterion. Single axis satellite attitude simulation system with noise was built up, which included satellite attitude dynamic model, sensors and actuators model. The control laws inputs were attitude error, attitude errors integral and angular velocity error, and outputs were actuators control instructions. Control laws fitness function was an attitude errors statistical function. With suitable function set selected for genetic programming (GP) and parse tree used to represent a control law expression, GP was used to evolve control law expression automatically. Simulation result shows that this method can evolve control law with uncertainties noise better. The evolved control law response and control precision are better than PID, and it can be used in satellite attitude control.