Python is more secure than PHP as it is a modern programming language. However, it has to be noted that PHP is not much way back from Python in this matter.