If $X$ is a complete nonsingular curve over $k$, $Y$ is any curve over $k$, $f: X \to Y$ is a morphism not map to a point (so $f(X)=Y$), then $f$ is a finite morphism.
This is the assertion prove in Hartshorne Chapter2, Prop6.8. But the proof is a little sketchy at the point of the inverse image of an affine set is also affine. I quote it here:
...Let $V=\rm{Spec}B$ be any open affine subset of $Y$. Let $A$ be the integral closure of $B$ in $K(X)$. Then $A$ is a finite $B$-module, and Spec$A$ is isomorphic to an open subset $U$ of $X$. Clearly $U=f^{-1}(V)$...
Can anyone explain why "Spec$A$ is isomorphic to an open subset $U$ of $X$. Clearly $U=f^{-1}(V)$"?