We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aecbd58 commit ea203b1Copy full SHA for ea203b1
Day-024/01-os.py
@@ -0,0 +1,16 @@
1
+#!/usr/bin/env python3
2
+
3
+import os
4
5
+# __file__ can represent the code file that's
6
+# being run, hence we use it here to showcase
7
+# a few features of os.access()
8
9
+# os.access() tests the access to a file using
10
+# the real uid/gid of the user executing the file
11
12
+print("Calling {}".format(__file__))
13
+print("Does exist: {}".format(os.access(__file__, os.F_OK)))
14
+print("Is readable: {}".format(os.access(__file__, os.R_OK)))
15
+print("Is writable: {}".format(os.access(__file__, os.W_OK)))
16
+print("Is executable: {}".format(os.access(__file__, os.EX_OK)))
0 commit comments