.py Python-Skript
Text & Quellcode
| MIME-Typ | text/x-python text/x-python3 |
|---|---|
| Beschreibung | Python-Skript |
| Kategorie | Text & Quellcode |
| Signatur (Magic Bytes) | 23 21 20 2F 62 69 6E 2F 70 79 74 68 6F 6E (#! /bin/python)23 21 2F 62 69 6E 2F 70 79 74 68 6F 6E (#!/bin/python) |
| Basiert auf | application/x-executable, text/plain |
| Weitere Endungen | .pyx, .wsgi |
Häufige Fragen
Was ist eine .py-Datei?
Die Endung .py wird für mehrere Formate verwendet: Python-Skript (text/x-python) und Python-3-Skript (text/x-python3).
Womit öffne ich eine .py-Datei?
Mit jedem Texteditor – etwa Notepad++, Visual Studio Code oder unter Linux gedit und vim. Die Datei enthält lesbaren Text, ggf. Quellcode oder Konfiguration.
Woran erkennt man eine echte .py-Datei?
Am Dateianfang, der sogenannten Signatur (Magic Bytes): 23 21 20 2F 62 69 6E 2F 70 79 74 68 6F 6E (#! /bin/python) und 23 21 2F 62 69 6E 2F 70 79 74 68 6F 6E (#!/bin/python). Unter Linux und macOS prüft file --mime-type example.py den tatsächlichen Typ unabhängig von der Endung.
Auf welchem Format basiert .py?
Technisch ist eine .py-Datei ein Untertyp von „Ausführbare Datei“ (application/x-executable). Programme für dieses Grundformat können die Datei daher oft ebenfalls lesen.
Welcher MIME-Typ gehört zu .py?
Der MIME-Typ ist text/x-python. Im Apache-Webserver: AddType text/x-python .py; in nginx: types { text/x-python py; }.