My spotted python does the exact same thing.
If it strikes you, don't put it down or leave it alone, because you teach it that striking gets it left alone. Once it's out of the cage, mine's fine and is as friendly as all my other snakes, it's just when he's in the cage that it's a problem.
My advice would be to try and pick it up quickly, while it is still unaware. He may bite you, but he won't get into striking position and you can take him out easily.
One trick I use for overly defensive snakes is to cool the cage down a little. If I know I want to handle my snake in advance, I'll unplug the heat source an hour before, so that it's slow and more lethargic.
Hope this helps, Jack
-----
1.0 Spotted python (Harry)
0.1 Stimsons python (Garry)
coming soon... 0.0.1 Diamond python
2 dogs (tracka and scruffy)
A bunch of fish
8 chooks (they crow early in the morning)