The most sure way to tell is to have an experienced vet or breeder probe the snake. A small metal rod is slid into the snake's cloaca. The depth that it can reach tells you the sex of the animal. Sometimes a snake can be "popped" meaning it's sex organs can be exposed...but if not done properly, it can damage the sex organs, especially on an older animal.

There's no certain way to visually sex a ball python.