← 返回列表

Python3 os 模块 Fpathconf 方法

Python3 os 模块 Fpathconf 方法 #!/usr/bin/python3 import os, sys # Open a file fd = os.open( "foo.txt", os.O_RDWR|os.O_CREAT ) print ("%s" % os.pathconf_names) # Now get maximum number of links to the file. no = os.fpathconf(fd, 'PC_LINK_MAX') print ("Maximum number of links to the file. :%d" % no) # Now get maximum length of a filename no = os.fpathconf(fd, 'PC_NAME_MAX') print ("Maximum length of a filename :%d" % no) # Close opened file os.close( fd) print ("Closed the file successfully!!")

Python3 os 模块 Fpathconf 方法

#!/usr/bin/python3
import os, sys

# Open a file
fd = os.open( "foo.txt", os.O_RDWR|os.O_CREAT )

print ("%s" % os.pathconf_names)

# Now get maximum number of links to the file.
no = os.fpathconf(fd, 'PC_LINK_MAX')
print ("Maximum number of links to the file. :%d" % no)

# Now get maximum length of a filename
no = os.fpathconf(fd, 'PC_NAME_MAX')
print ("Maximum length of a filename :%d" % no)

# Close opened file
os.close( fd)

print ("Closed the file successfully!!")

打开资源 ↗

交流与评论