Although similar questions has been asked, I still didn't find a clear and simple answer only involved with connectedness and restriction function.
In particular, to prove $[0,1)$ is not homeomorphic to $(0,1)$, we only need to consider the restriction function $f: [0,1)\setminus \{0\}$ to $(0,1)\setminus \{f(0)\}$, obviously the former is connected and the latter disconnected, contradicting $f$ being a homeomorphism.
However, I have tried $\Bbb R^2 \setminus \{p\}$ and $\Bbb R^2\setminus \{L\}$ where $p$ is a point and $L$ a line, none of them provide a satisfactory counterexample. Is this possible to construct a contradiction?