  We generalize a version of Lavrent\'ev's theorem which says that a function
that is continuous on a compact set K with connected complement and without
interior points can be uniformly approximated as closely as desired by a
polynomial without zeros on the set K, so that the polynomial can avoid values
from any given countable set. We also prove a corresponding version of
Mergelyan's theorem when the interior of K is a finite union of Jordan domains,
pairwise separated by a positive distance.
