Additional to Aarons correct answer here the a way to use atan2atan2 as suggested by Mike T and the transformation to geographical Degrees where the geographical North is at 0/360°.
# Pre-Loci Script Code
import math
def GetGeographicalDegrees(shape):
radian = math.atan2(shape.lastpoint.y - shape.firstpoint.y,
shape.lastpoint.x - shape.firstpoint.x)
radian = radian - (math.pi /2 ) # turn minus 90°
if (radian > 0):
degrees = 360 - ( radian * 360) / ( 2 * math.pi )
else:
degrees = 360 - ((2* math.pi + radian ) * 360) / ( 2 * math.pi )
return degrees
# angle =
GetGeographicalDegrees( !SHAPE! )
Example: