Solution (source code)

= Solution

For each $b\in B$, use the supplied <Hausdorff condition> fact to choose disjoint <open sets> $U_b,V_b$ with $A\subseteq U_b$ and $b\in V_b$. <Compactness> of $B$ gives finitely many $b_1,\ldots,b_r$ whose $V_{b_j}$ cover $B$. Set
$$
\boxed{U=\bigcap_{j=1}^rU_{b_j},\qquad V=\bigcup_{j=1}^rV_{b_j}.}
$$
Both are open; $U$ contains $A$ and $V$ contains $B$. They are disjoint because membership in $U\cap V$ would put a point in some $U_{b_j}\cap V_{b_j}$. If one <compact> set is empty, use the empty set and $X$ directly. Thus \b[disjoint <compact> subspaces of a <Hausdorff space> admit disjoint open neighborhoods].