Blender ships with a powerful Python API called bpy. In theory, you can script every operation the GUI offers: modeling, animation, rendering, compositing, physics simulations, and more. In practice, ...
Select your object in Edit Mode. Select the faces whose normals you want to align. Open the Python script (Align_Face_Normals_Z.py) in the Blender Text Editor and click Run Script (Alt+P). The face ...