On http://www.facebook.com/LearningBlender2.5, someone asked this question and this was my solution. Having never tried this before, it was a nice challenge for me figure it out. It was not that hard actually, thanks to the new Blender Python API.
So I created a bezier curve with three control points. Then the following two methods easily answered the question..
So what is going on here?
By running the command below, we are storing the active object (at index zero) in "curve".
The following command prints out the number of splines that compose the curve object. In the screenshot above, the curve object consists of only one spline.
We get an answer of 1.
We are now printing the number of bezier points that are present in the first spline object (at index zero).
We get an answer of 3.
The following commands selects the first and third control point in the 3D View. The first CV is at index 0 and the third CV at index 2.
And what is happening in this second method?
While in the previous case we used "bpy.contect.selected_objects" to get access to the active object, in this example we are getting the access directly using "bpy.context.active_object". Rest of the code is same as the first example.
Hope this helps.
satishgoda at gmail dot com