python文件操作 seek(),tell()
f.seek(0)移动到文件开头
seek():移动文件读取指针到指定位置
tell():返回文件读取指针的位置
seek()的三种模式:
(1)f.seek(p,0) 移动当文件第p个字节处,绝对位置
(2)f.seek(p,1) 移动到相对于当前位置之后的p个字节
(3)f.seek(p,2) 移动到相对文章尾之后的p个字节
python文件操作 seek(),tell()
f.seek(0)移动到文件开头
seek():移动文件读取指针到指定位置
tell():返回文件读取指针的位置
seek()的三种模式:
(1)f.seek(p,0) 移动当文件第p个字节处,绝对位置
(2)f.seek(p,1) 移动到相对于当前位置之后的p个字节
(3)f.seek(p,2) 移动到相对文章尾之后的p个字节