Warning: This story contains graphic images
Attaporn Boonmakchuay, 38, found himself in a tug of war with the creature which was "yanking very hard".
His wife came to the rescue and they were eventually able to wrestle it off but not before he had lost a lot of blood as can be seen in the horrific photos and video of the scene.
She managed to tie a rope around the python and pried its jaws open at which point her husband passed out.
Attaporn who lives in Chachoengsao province, east of Bangkok, said: "I felt as though my penis had been severed."
Doctors praised him for his surprisingly chipper outlook on his recovery.
Chularat Hospital director Dr Chutima Pincharoen said: "He has a really good attitude... even though his own wife and children were in shock. He's been smiling and giving interviews all day from his bed,"
The toilet was dismantled so the python could be extracted. It was then released into the wild.
Attaporn says he plans to replace his squat toilet with a sitting one.