← 返回列表

Python3 os 模块 Read 方法

Python3 os 模块 Read 方法 # !/usr/bin/python3 import os, sys # Open a file fd = os.open("foo.txt",os.O_RDWR) # Reading text ret = os.read(fd,12) print (ret.decode()) # Close opened file os.close(fd) print ("Closed the file successfully!!")

Python3 os 模块 Read 方法

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

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

# Reading text
ret = os.read(fd,12)
print (ret.decode())

# Close opened file
os.close(fd)
print ("Closed the file successfully!!")

打开资源 ↗

交流与评论