$ chmod 755 somefile

In python2:

$ python -c "import os; os.chmod('somefile', 0755)"

But in python3:

$ python3 -c "import os; os.chmod('somefile', 0o755)"