Police found the snakes, ranging from 1 foot to 4-1/2 feet in length, in a motel in Brantford, a city about 62 miles southwest of Toronto.
"The snakes were not being suitably cared for and were in distress. The anxious officers called the Society for the Prevention of Cruelty to Animals who attended and took 40 pythons into their care," local police said in a statement.
The snakes are expected to be fine, they said. No one at the Brantford police or at the SPCA were available for comment.
A manager at the motel said the snakes belonged to a couple who had checked into a room for one night, and who were out when police arrived on Thursday evening.
Pythons are not legal for home ownership in Brantford, according to the city's animal control bylaws.
Last week, two young boys in Eastern Canada died after a 13-foot, 100-lb python apparently attacked them in their sleep. An autopsy confirmed the two died of asphyxiation.