TextText-based
text/x-python
Python Source
Reference for text/x-python, the MIME type for Python source code files used in web, data science, and automation.
MIME Type Detector
Drop a file to detect its MIME type — no upload, runs in your browser
📄
Drop any file here or click to choose
Expected extensions: .py, .pyw
HTTP Content-Type Header
HTTP Header
Content-Type: text/x-python; charset=utf-8Associated File Extensions
.py.pyw
Quick Facts
| MIME Type | text/x-python |
| Category | Text |
| Type | Text-based (human-readable) |
| Extensions | .py, .pyw |
Common Usage
Python source files contain code for web applications (Django, Flask, FastAPI), data science (NumPy, Pandas), machine learning (TensorFlow, PyTorch), automation scripts, and system administration. This MIME type helps editors and servers identify Python content.
Code Examples
HTML
<!-- Link or embed with explicit type -->
<link rel="stylesheet" href="file.py" type="text/x-python">
<!-- Or for script/media elements -->
<script type="text/x-python" src="file.py"></script>Node.js
// Express.js
app.get('/file', (req, res) => {
res.type('text/x-python');
res.send(data);
});
// Node.js http
res.writeHead(200, { 'Content-Type': 'text/x-python' });nginx
# nginx.conf — add to types block or use default
types {
text/x-python py pyw;
}
# Or set for a specific location
location /api/ {
default_type text/x-python;
}Related MIME Types
More Text MIME Types
Other text types in the Text family
Related Tools
Explore More MIME Types
Browse our complete reference of 185 MIME types with usage examples, HTTP headers, and code snippets.