insertPoint.py
import arcpy
#Create a cursor for inserting data.
#1st argument: Data name to be operated. Specify the TestPoint feature class (point type) created in advance.
#Second argument: The field name in the data. Created by default in TestPoint
#There are only two fields, OBJECTID and SHAPE.
#OBJECTID is not an operation target (can't it? It shouldn't be done in the first place ...), so
#Here, specify the SHAPE field (XY coordinates).
cursor = arcpy.da.InsertCursor(
"D:/GIS/ArcGIS_Project/GeometryTest/GeometryTest.gdb/TestPoint",
["SHAPE@XY"])
#XY coordinates(0, 0)Insert point data.
#Arguments: A list of field values. In the above[SHAPE@XY]I specified that, so according to it[XY coordinates]Give in the list.
cursor.insertRow([(0, 0)])
#XY coordinates(1, 1)And(2, 2)Insert points as well.
cursor.insertRow([(1, 1)])
cursor.insertRow([(2, 2)])
#Delete the cursor.
#Note: If you do not do this, the data operations up to the above will not be confirmed, so don't forget.
del cursor