파이썬의 큰 바이너리 데이터 파일에서 임의의 덩어리를 읽고 싶습니다. 지금까지는 제 문제에 대한 좋은 해결책을 찾지 못했습니다.파이썬에서 큰 바이너리 파일의 부분 읽기
내가 지금까지 가지고있는 것은 다음과 같지만 처음에는 n 정수 만 읽을 수 있으며 파일의 다른 곳에서는 시작할 수 없습니다.
import numpy as np
#Pick an n here.
f = open("test2.rd14")
a = np.fromfile(f, dtype = np.uint16, count=int(n))
또한 너무 큰에서 파일이이 문서의 전부
with open("test2.rd14") as file:
filecontent = file.read()
아마도 도움이 될 수도있는 [this] (http://stackoverflow.com/questions/1035340/reading-binary-file-in-python-and-looping-over-each-byte)를 확인해야합니다. – kessi