TITLE: The fundamental group of the complement of an analytic subset of codimension at least $2$
QUESTION [12 upvotes]: Let $X$ be a compact complex manifold and $V$ an analytic subset of $X$ of codimension $\ge 2$. By intuition, il might be true that the fundamental group of $X$ equals that of $X \backslash V.$ I would like to ask if the last claim is true or not and in the affirmative case, how do we prove it? Thank you in advance.

REPLY [11 votes]: The answer is yes.
Just triangulate $X$ in such a way that $V$ is a subpolyhedron (this can be done by Lojasiewicz's theorem). Now it is well-known that removing a subpolyhedron of (real) codimension at least $3$ does not affect the fundamental group for transversality reasons.
Edit. Actually, Lojasiewicz's theorem is not necessary. In fact, the analytic subset $V$ provides a closed real submanifold of codimension at least $4$ of the underlying real manifold of $X$, so we can use the following result, whose proof can be found for instance in
C. Godbillon, Eléments de Topologie Algebrique, Théorème 2.3 page 146:

Theorem. Let $X$ be a smooth, connected real manifold without boundary, $V \subset X$ a closed submanifold, $x$ a point of $X\setminus V$ and $i \colon X \setminus V \longrightarrow  X$ the inclusion map. Then

if the codimension of $V$ is at least $2$, the group homomorphism $$i_* \colon \, \pi_1(X \setminus V, \, x) \longrightarrow \pi_1(X, \, x)$$ is surjective;
if the codimension of $V$ is at least $3$, the group homomorphism $$i_* \colon \, \pi_1(X \setminus V, \, x) \longrightarrow \pi_1(X, \, x)$$ is an isomorphism.