从任意位置读取任意长度数据
def funn(location,length):
path = os.path.join(os.path.abspath(os.path.dirname(__file__) + os.path.sep + ".."), "xxxx", "xxxx")
filedir = os.path.join(path,filename)
try:
with open(filedir, 'r') as fs:
fs.seek(location, 1) # location为 开始的偏移量,也就是代表需要移动偏移的字节数
databuffer = fs.read(length)
except Exception as E:
log.error(E.message)
按顺序读取文件数据
class test(object):
keeplocation = "" #全局保存读取文件的位置,循环调用funn函数,可以按顺序不断读取文件数据
def funn(self,length):
path = os.path.join(os.path.