MohdKhan I would be careful with that - allowing uploading arbitrary text file may open you to XSS attacks ( if someone will send HTML or JavaScript file) or even RCE (if someone sends PHP file). The whole idea of uploading .py file may be dangerous because of this - you need to make sure that these files will not be interpreted and executed on server side.
But if you're sure you need this, I would try text/x-python.