Vuoi usare os.stat() :
os.stat(path)
 Perform the equivalent of a stat() system call on the given path. 
 (This function follows symlinks; to stat a symlink use lstat().)
The return value is an object whose attributes correspond to the 
members of the stat structure, namely:
- st_mode - protection bits,
- st_ino - inode number,
- st_dev - device,
- st_nlink - number of hard links,
- st_uid - user id of owner,
- st_gid - group id of owner,
- st_size - size of file, in bytes,
- st_atime - time of most recent access,
- st_mtime - time of most recent content modification,
- st_ctime - platform dependent; time of most recent metadata 
             change on Unix, or the time of creation on Windows)
 Esempio di utilizzo per ottenere l'UID del proprietario:
from os import stat
stat(my_filename).st_uid
 
 Nota, tuttavia, che stat restituisce il numero ID utente (ad esempio, 0 per root), non il nome utente effettivo. 
È una vecchia domanda, ma per coloro che cercano una soluzione più semplice con Python 3.
 Puoi anche usare Path da pathlib per risolvere questo problema, chiamando il Path owner di e group metodo come questo:
from pathlib import Path
path = Path("/path/to/your/file")
owner = path.owner()
group = path.group()
print(f"{path.name} is owned by {owner}:{group}")
 Quindi in questo caso, il metodo potrebbe essere il seguente:
from typing import Union
from pathlib import Path
def find_owner(path: Union[str, Path]) -> str:
    path = Path(path)
    return f"{path.owner()}:{path.group()}"
 Non sono proprio un pitone, ma sono stato in grado di creare questo:
from os import stat
from pwd import getpwuid
def find_owner(filename):
    return getpwuid(stat(filename).st_uid).pw_name
 Mi sono imbattuto in questo di recente, cercando di ottenere l'utente proprietario e il gruppo informazioni, quindi ho pensato di condividere ciò che mi è venuto in mente:
import os
from pwd import getpwuid
from grp import getgrgid
def get_file_ownership(filename):
    return (
        getpwuid(os.stat(filename).st_uid).pw_name,
        getgrgid(os.stat(filename).st_gid).gr_name
    )