.py Script Python
Testo e codice sorgente
| Tipo MIME | text/x-python text/x-python3 |
|---|---|
| Descrizione | Script Python |
| Categoria | Testo e codice sorgente |
| Firma (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) |
| Basato su | application/x-executable, text/plain |
| Altre estensioni | .pyx, .wsgi |
Domande frequenti
Che cos’è un file .py?
L’estensione .py viene usata per diversi formati: Script Python (text/x-python) e Script Python 3 (text/x-python3).
Come apro un file .py?
Con qualsiasi editor di testo: Notepad++, Visual Studio Code, oppure gedit e vim su Linux. Il file contiene testo leggibile, eventualmente codice sorgente o configurazione.
Come si riconosce un vero file .py?
Dai byte all’inizio del file, la firma (magic bytes): 23 21 20 2F 62 69 6E 2F 70 79 74 68 6F 6E (#! /bin/python) e 23 21 2F 62 69 6E 2F 70 79 74 68 6F 6E (#!/bin/python). Su Linux e macOS, file --mime-type example.py verifica il tipo reale indipendentemente dall’estensione.
Su quale formato si basa .py?
Tecnicamente un file .py è un sottotipo di «Eseguibile» (application/x-executable), quindi i programmi per quel formato di base spesso riescono a leggerlo.
Quale tipo MIME corrisponde a .py?
Il tipo MIME è text/x-python. Nel server web Apache: AddType text/x-python .py; in nginx: types { text/x-python py; }.