I was working on a python project to send information to the server, and while I found good code to read the file and send it, I can send everything at once. Instead, I want to be able to read 1000 characters at a time and loop to the end of the file. I'm sure this is pretty easy, but I'm not sure where to change what I did to make this happen. It may also be due to ignorance with the reading method, but I study it and I can not find any information that clarified this for me. This is what I work with:
with open(localFileTT, 'rb', 0) as f: #open the file for fstr in f: str.encode(fstr) print(fstr) if 'str' in fstr: break
I have not yet introduced the network functions in this code, as this is only test material to figure out how to read only 1000 at a time. Of course, he reads the entire section well enough, but I don’t know how to change it to read only parts at a time. I would try just adding a read (1000), but that prints a void! I’m not sure exactly where the reading is taking place, and, unfortunately, the articles that I read on the Internet have so far not helped on parts of this code (for example, c). If someone can point me in the right direction, then I will be very grateful.
source share