It may come out on its own. If you know where it entered and that access is the only one it has available, sprinkle some cooking flour on the ground. Check the spot periodically and look for signs in the flour indicating the snake has departed. Only close the hole permanently when you are certain that all the snakes are gone and that no other animals or stinging insects are using the location.
If the situation does not indicate the snake will leave on its own, here is a non-lethal way to catch it. Use a glue board purchased from an agriculture supply or hardware store. (Glue boards are often used to trap mice or rats.) Most small snakes can be captured using a single glue board placed against a wall or away from pipes or other objects a snake could use for leverage to escape. To capture larger snakes, make a larger area of glue boards. Construct the trap using a 16 x 24-inch piece of 1/4-inch plywood. Drill a 3/4-inch hole in one corner of the board. When you need to remove the board, use a hook on the end of a long stick to grab the corner through the hole. Fasten or securely glue two to four glue boards along one side of the plywood board. This type of trap, when placed against a wall, is capable of capturing snakes up to five or six feet long. This method takes advantage of the snake habit of crawling along the edge of things. Use glue boards only indoors or under structures where children, pets, and other wildlife cannot reach them—the glue is quite messy and hard to remove. Use common cooking or vegetable oil to remove animals from the glue. Once the unwanted guests have been removed, be sure to close any holes or entrances so more snakes do not enter.
Resources (online):
Reptiles