Test whether a path is a regular file
(path)
| 35 | # This follows symbolic links, so both islink() and isdir() can be true |
| 36 | # for the same path on systems that support symlinks |
| 37 | def isfile(path): |
| 38 | """Test whether a path is a regular file""" |
| 39 | try: |
| 40 | st = os.stat(path) |
| 41 | except (OSError, ValueError): |
| 42 | return False |
| 43 | return stat.S_ISREG(st.st_mode) |
| 44 | |
| 45 | |
| 46 | # Is a path a directory? |
searching dependent graphs…