I know the title is a bit off, but what I'm asking is if it is possible to have a python script on my website that can detect if my Android phone is connected to the computer Im using to view the page. I don't know if this is possible since I think python is server-side, but maybe this is possible to do with JavaScript? I'm fairly new to programming so I may not be as smart as you guys out there but if someone could just lead me in the right direction I would be grateful.
What you're looking for is not TOTALLY ABSOLUTELY impossible, but you may need some help from the computer you connect the device to, from the browser you're visiting your site with or from the device itself. Some possible options:

have a program running on your computer which checks if the device is connected and pinging a certain URL on your website if it is.
write a browser plugin which checks if the device is connected and exposing the information via some JS API - the JS code on your site will be able to use it.
have a program running on your device which pings your site each time the device is connected to a computer.

Admittedly, all the solutions are from the "tricky" category :)
Python on website to connect to phone connected to computer