A man in Thailand has prised a large python off his genitals after it bit him while he sat on a toilet.

Attaporn Boonmakchuay needed stitches but should make a good recovery. ( Thai Channel 7/AP )

Attaporn Boonmakchuay, 38, told Thailand's Channel 7 he struggled with the 3-metre python for half an hour after it came up through the plumbing and bit him on the penis.

"I fought it. I called my wife and she went to get the neighbour," he said from his hospital bed.

"It took about a minute for the neighbour to get here. And all of a sudden, while I was holding it, it began to lose some strength so I used my hand to prise open its mouth. Then the snake released its grip by itself."

He fainted from loss of blood after removing the snake.

Doctors said he needed stitches, but should heal well.

"I think he's lucky," hospital director Dr Chutima Pinchareon said.

"We have to watch for infection. If there's none and if the wound is healing well he should be able to go home.

"But if the bite had gone into the urinary tract it would have been a big problem."

Rescue workers had to dismantle the toilet to remove the snake from the plumbing, then carry the toilet outside before chipping off enough porcelain using hammers to remove the snake.

Large snakes are common in Thailand and are more likely to be seen in urban areas at the onset of the rainy season, when they flee flooded fields for higher ground.

ABC/APTN