We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e6b89ea commit 8a2a033Copy full SHA for 8a2a033
python-stdlib/os-path/os/path.py
@@ -66,6 +66,14 @@ def isdir(path):
66
return False
67
68
69
+def isfile(path):
70
+ try:
71
+ mode = os.stat(path)[0]
72
+ return mode & 0x8000
73
+ except OSError:
74
+ return False
75
+
76
77
def expanduser(s):
78
if s == "~" or s.startswith("~/"):
79
h = os.getenv("HOME")
python-stdlib/os-path/test_path.py
@@ -20,3 +20,7 @@
20
assert isdir(dir + "/os")
21
assert not isdir(dir + "/os--")
22
assert not isdir(dir + "/test_path.py")
23
24
+assert not isfile(dir + "/os")
25
+assert isfile(dir + "/test_path.py")
26
+assert not isfile(dir + "/test_path.py--")
0 commit comments