In the answer of this question, it says that the complement of an effective Cartier divisor in an irreducible affine scheme is affine. However, I can't think of a proof (actually I'm not sure how to use the property of being locally principal, as affineness is a global thing).
(solved) One more question is that, again in the linked answer, an example is given where the complement of Weil divisor is not affine. This is confusing me as any Cartier divisor is a Weil divisor almost by definition - at least under the assumption that $X$ is regular in codimension one (context in Hartshorne's text). But it looks to me that the mentioned $X$ is regular in codimension one, only singular at the vertex.
I would greatly appreciate any proof for the first question and clarification on the second one.