KB wrote:
Thanks, John.
But my point is how to keep the leading zero in 0777,
in order to be used in os.chmod('myfile', 0777)?
I don't understand. The leading zero only exists in a particular string
representation. os.chmod() needs an integer, not a string. 0777 == 511.
os.chmod('myfile', 0777)
os.chmod('myfile', 511)
os.chmod('myfile', int('777', 8))
They all do *exactly* the same thing. End of story.
If you really need a string representation in octal (os.chmod()
doesn't), then use oct() on the integer.
--
Robert Kern
rk***@ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter