How to read from a file to an arbitrary delimiter efficiently?

BartC bc at freeuk.com
Sat Feb 27 15:28:40 EST 2016


On 27/02/2016 20:03, BartC wrote:
> On 27/02/2016 16:35, BartC wrote:

>> Any faster solutions would need to read more than one byte at a time.
>
> I've done some more test using Python 3.4, with the same 200,000 line
> 6MB test file:
>
> 0.25 seconds       Scan the file with 'for line in f'
> 2.25 seconds       Scan the file with your readlines() routine

That's not right. 0.25 seconds was for readlines(). 2.25 for a f.read(1) 
loop.





More information about the Python-list mailing list