python - How to convert a stat output to a unix permissions string -


if run os.stat(path) on file , take st_mode parameter, how there string this: rw-r--r-- known unix world?

since python 3.3 use stat.filemode:

in [7]: import os, stat  in [8]: print(stat.filemode(os.stat('/home/soon/foo').st_mode)) -rw-r--r--  in [9]: ls -l ~/foo -rw-r--r-- 1 users 0 jul 23 18:15 /home/soon/foo 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -