How to read records terminated by custom separator from file in python?
There is nothing in the Python 2.x file object, or the Python 3.3 io classes, that lets you specify a custom delimiter for readline. (The for line in file is ultimately using the same code as readline.) But it’s pretty easy to build it yourself. For example: def delimited(file, delimiter=”\n”, bufsize=4096): buf=”” while True: newbuf … Read more