The process for this seems to have changed between ArcGIS 10.0 and 10.1. I will include a sample for both.
Here is the help document on reading geometries in 10.1 using arcpy: Reading Geometries 10.1
This document discusses the parameters for a Polyline geometry type: Polyline (arcpy)
10.1
import arcpy
infc = arcpy.GetParameterAsText(0)
# Enter for loop for each feature
#
for row in arcpy.da.SearchCursor(infc, ["OID@", "SHAPE@"]):
# Print the current line ID
print("Feature {0}:".format(row[0]))
#Set start point
startpt = row[1].firstPoint
#Set Start coordinates
startx = startpt.X
starty = startpt.Y
#Set end point
endpt = row[1].lastPoint
#Set End coordinates
endx = endpt.X
endy = endpt.Y
10.0
Here is the help document on reading geometries in 10.0 using arcpy: Reading Geometries 10.0
This document discusses the parameters for a Geometry object: Geometry
import arcpy
infc = arcpy.GetParameterAsText(0)
# Identify the geometry field
#
desc = arcpy.Describe(infc)
shapefieldname = desc.ShapeFieldName
# Create search cursor
#
rows = arcpy.SearchCursor(infc)
# Enter for loop for each feature/row
#
for row in rows:
# Create the geometry object
#
feat = row.getValue(shapefieldname)
# Print the current line ID
#
print "Feature %i:" % row.getValue(desc.OIDFieldName)
#Set start point
startpt = feat.firstPoint
#Set Start coordinates
startx = startpt.X
starty = startpt.Y
#Set end point
endpt = feat.lastPoint
#Set End coordinates
endx = endpt.X
endy = endpt.Y
The difference between the two basically lies in how you access the feature geometry. There have been some shortcuts added in 10.1 to make it easier to get to the geometry object.