File Permission in Unix

Michael Hudson mwh at python.net
Wed Nov 14 13:35:23 EST 2001


Dave Swegen <dswegen at allstor-sw.co.uk> writes:

> On Wed, Nov 14, 2001 at 07:04:07PM +0200, Amit Weisman wrote:
> > Hi
> > How do one creates a file with specified permissions (e.g. , 777) within
> > Python ?
> 
> os.chmod is your friend. Use os.chown to change ownership of a file.

Or use os.open with appropriate flags if it's important that the file
be created with the appropriate permissions.  Then use os.fdopen to
get a nice friendly file object.

Cheers,
M.

-- 
42. You can measure a programmer's perspective by noting his
    attitude on the continuing vitality of FORTRAN.
  -- Alan Perlis, http://www.cs.yale.edu/homes/perlis-alan/quotes.html



More information about the Python-list mailing list