I need to find a way to read x bytes of data from a list containing strings. Each item in the list is ~ 36 MB. I need to be able to run each item in the list, but only grab about ~ 1 Kbyte of that item at a time.
Essentially, it looks like this:
for item in list:
My current code (what kind of work, but seems to be rather slow and inefficient) is this:
for character in bucket:
print character
packet = "".join(character)
if(len(packet.encode("utf8")) >= packetSizeBytes):
print "Bytes: " + str(len(packet.encode("utf8")))
return packet
I am wondering if there is something like f.read(bufSize), but for strings.
Not sure if this is relevant, but for a larger context, this is what I am doing:
( ) ( ). f.read(chunkSize) buckets. - , , .
, . , , , . , , , - , . - , , .