# Reading attribute from shapefile using ArcPy

Currently I am making a script that allows the user to draw a line, the line is then created into end points with lat/long available.

From this lat/long, I have to run some math equations to figure out where the next coordinates should be. I have gotten it to create the points based on a line, calculate the bearing, and used ArcPy to place the next point into the shapefile using my math equation as a test.

I am using Arcmap 10.4 for testing. I have access to Pro and 10.7, but I am using 10.4 just to learn.

My question is how do I read the attributes of a file so that I can use the X/Y of a point to run my equations on?

I have (light) experience using Pandas, working with CSV's etc just very new to ArcPy. Below is a list of what I am doing to make it easy.

1. Create line. Use COGO to add bearing.
2. Create points from lines.
3. Read attribute table. Read X/Y. (This is what I need help with).
4. Run equation on X/Y to get the next 4 points.
5. Add points to point shapefile.

When I have it figured out I can provide an update to share the code with for future use.

• You could just use the make XY event layer tool which makes an in-memory layer object which you can either process directly or save out to a permanent dataset which you process (e.g. add new fields to). – Hornbydd Mar 24 at 19:07
• I will take a look at using this option. That sounds like it would be useful for this. – Brian Hamilton Mar 24 at 20:09

Try the da.SearchCursor:

import arcpy