How to set custom vertex normals for certain vertices using python?
Example of assigning custom normals based on vertex selection. It's just a slight modification of the code given in this answer and assigns a custom vector to vertices in selection.



Run the script in Object Mode and enable show_split_normal property in Edit Mode:

import bpy

context = bpy.context
ob = context.object
me = ob.data

me.use_auto_smooth = True

# Normal custom verts on each axis
me.normals_split_custom_set([(0, 0, 0) for l in me.loops])

# Set normal for selected vertices
normals = []
for v in me.vertices:
    if v.select:
    # if v.index in (0, 1, 4): # Alternatively you can ask for certain indices
        normals.append((0, 0, -0.5))
    else:
        normals.append(v.normal)

# make csn's all face up.  
me.normals_split_custom_set_from_vertices(normals)

#me.free_normals_split()


Note: As of 2.8x show_split_normal property is part of the Overlays menu: