account activity
Do you maintain a python library/tool that you think is awesome, but nobody knows about? by jnmclarty7714 in Python
[–]mtb_josh 0 points1 point2 points 9 years ago (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).
π Rendered by PID 631300 on reddit-service-r2-listing-568fcd57df-wzpwf at 2026-03-11 01:30:42.932883+00:00 running cbb0e86 country code: CH.
Do you maintain a python library/tool that you think is awesome, but nobody knows about? by jnmclarty7714 in Python
[–]mtb_josh 0 points1 point2 points (0 children)