How to read from a file to an arbitrary delimiter efficiently?
Wolfgang Maier
wolfgang.maier at biologie.uni-freiburg.de
Thu Feb 25 02:37:14 EST 2016
On 25.02.2016 07:50, Steven D'Aprano wrote:
> I have a need to read to an arbitrary delimiter, which might be any of a
> (small) set of characters. For the sake of the exercise, lets say it is
> either ! or ? (for example).
>
You are not alone with your need.
http://bugs.python.org/issue1152248 discusses the problem and has some
code snippets that you may be interested in. While there is no trivial
solution there are certainly faster ways than your first attempt.
Wolfgang
More information about the Python-list
mailing list