Search code examples
pythonliteralsoctal

What is the meaning of 0o777 as value of mode of mkdir?


I would like to use mkdir in python.

It has a parameter mode, whose default value is '0o777'.

I know file mode 0777 in Linux. However I don't know what o between 0 and 777 is. What is it?


Solution

  • It is a Python friendly way of expressing file permissions, using octal numbers.

    >>> 0o777
    511