BGE get controller/joystick count in python
bge.logic.joysticks gives a list of the max number of controllers (eight), now if there is not a controller the list will have None in that slot. 

All you need to do is count how many not None items are in that list, or what I did, count how many are None.

connected_controllers  = 8 - bge.logic.joysticks.count(None)


Since we know there are always eight controller slots, it counts how many are "None" and subtracts that from 8. Quite simple really.