Creating path curve using python script I'm using the following script to create path curve: 

def create_curve(coords_list):
    crv = bpy.data.curves.new('crv', 'CURVE')
    crv.dimensions = '3D'
    spline = crv.splines.new(type='NURBS')
    spline.points.add(len(coords_list) - 1) 
    for p, new_co in zip(spline.points, coords_list):
        p.co = (new_co + [1.0])  # (add nurbs 
    obj = bpy.data.objects.new('object_name', crv)
    bpy.data.scenes[0].collection.objects.link(obj)


coords_list generated using another script.
here are the first coordinates in coords_list:

coords_list[0] = [0,0,1]
coords_list[1] = [1.079576297914498, 0.12957629791449818, 1]
coords_list[2] = [1.796242964581165, -0.5870903687521685, 1]


But if you look at the layout tab it looks like the first and second coordinates were not included in the path curve for some reason.



What am I doing wrong? 
How can I print all the points ensamble the path curve?
If you want to include the first and last coordinates you need to add the following lines after creating the curve:

spline.use_endpoint_u = True
spline.use_endpoint_v = True


so you finaly get:

def create_curve(coords_list):
    crv = bpy.data.curves.new('crv', 'CURVE')
    crv.dimensions = '3D'
    spline = crv.splines.new(type='NURBS')
    spline.points.add(len(coords_list) - 1) 
    for p, new_co in zip(spline.points, coords_list):
        p.co = (new_co + [1.0])
    spline.use_endpoint_u = True
    spline.use_endpoint_v = True
    obj = bpy.data.objects.new('object_name', crv)
    bpy.data.scenes[0].collection.objects.link(obj)