No matter how it is: a normal housefly lives for several weeks and even more. That kind of flies that flew frantically throughout the apartment and desperately beats into the glass is called a housefly (Musca domestica – lat.). It is the most common type of flies on earth, and especially this insect can be found in cities and towns.
The most comfortable temperature for living a housefly is 23C °, that is, the usual room temperature. In such conditions a housefly can live from 15 to 25 days, although among them there are also real long-livers who can live more than a month. But the more the temperature differs from the optimum, the less flies live.
So, if you can not catch an insect, there is an option to freeze or, on the contrary, to heat your house and wait a few days. Although, of course, it is unlikely that you will like to bite your teeth with cold or languish from the heat – the good old sneakers and dexterity are much preferable.