Is there any way to read GSM modem port number programmatically using Python, when I connect mobile to Windows XP machine?
Sorry I donot know the python syntaxes, just an idea to follow. You can use SerialPort.GetPortNames(); to get the list of available ports in your system. 
And then send an AT command to each port. Which ever port responds with an OK , it means that your modem is connected to that port.
Programmatically read GSM modem port number