Joining several splines I try to use points from an import as a spline to make curves as paths to follow for an animation. 

These curves share some points at the ends and beginning when I import them via Python.

For example
s1: A-a-b-B
s2: C--D
s3: B-c-C
s4: D-d-E

which in the viewport look like
A-a-b-B-c-C--D-d-E

I want to join them together, so that I'll have one single spline 
s5: A-a-b-B-c-C--D-d-E

I could use CtrlJ to join them, but they are still not merged at their shared points, which makes the rest of the spline not used for the following. 
If I join them it looks like:
s1: A-a-b-BB-c-CC--DD-d-E

Also, another part of the problem is that the order of the splines from the import is not given, that s1 and s2 may not have shared nodes, and are only connected to each other via others like s3 and s4.

Is there a way to merge them? via commands or scripting
Select the two ends you want to join in editmode and press F. If the shared ends are in the same place, you might want to delete one of them before connecting the curves.