Yes, but if you want the generator to power your house as if nothing had happened, the details of installing it are both complex and important. You'll need an electrician and a decent-sized checkbook.
The specific term of art is a "transfer switch". The phrase "decent sized checkbook" in the HN context might be $10k-$10m, but installing a transfer switch would only be a few thousand bucks if done to code by a professional.