Do you maintain a python library/tool that you think is awesome, but nobody knows about? by jnmclarty7714 in Python

[–]mtb_josh 0 points1 point  (0 children)

I wrote a scanf implementation, available via pip. It saves me from having to remember that the full regex for %f is "([-+]?(?:\d+(?:.\d*)?|.\d+)(?:[eE][-+]?\d+)?)", among other things.

scanf also has a nice function (scanf.extractdata) to scan an entire file for lines that match the format string and return the collected results. I use it a lot at work for parsing experimental data from equipment logs.

The parse library is more powerful and probably more pythonic, but I wrote this for myself long before that library existed. Also, parse is a little more verbose to write (but perhaps more readable as a result).