Tuesday, 15 March 2011

linux - how to find the owner of a file or directory in python -


I need the function or method in Python to find the file or directory owner.

The function should be like:

  & gt; & Gt; & Gt;  

I'm not really / remove ("/ home / somedir / somefile" one Many of the dragon man, but I was able to whip it: PWD Import from getpwuid def find_owner (filename) from OS import state

 : return getpwuid (state (filename) .st_uid). Pw_name  

No comments:

Post a Comment