How to bring in a specific column into buffer or bytearray from a .dat file in python

67 Views Asked by At

I have a .dat file with 4 columns (and 4 rows). I am trying to bring in only the 3rd column called 'narratives' into a buffer. If that is not possible, can one bring in just the 'narrative' column into a bytearray? I haven't located anything on the web on this and don't know where to start.

My code so far brings in all four columns:

import os

with open("mini.dat", "rb") as f:
data = bytearray(os.path.getsize("mini.dat"))   
f.readinto(data)
0

There are 0 best solutions below