Most snakes all happily eat mice and rats in captivity, depeding on the size ad species of the snake.
Corn snake hatchlings will eat 1 frozen thawed pinky mouse per week, corn yearlings and bi-yearlings will take fuzzy mice and older to adults will take hopper or adult mice.
Avoid feeding corn snakes rats as their etabolisms are rather slow and the high fat content of rats will cause your corn snake to become obese.
Larger species of milk snakes however can happily take rats. It all depends on what you keep.
Please do your research before prouring your future pet.