Python Forum
convert digits until a non-digit - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: General (https://python-forum.io/forum-1.html)
+--- Forum: News and Discussions (https://python-forum.io/forum-31.html)
+--- Thread: convert digits until a non-digit (/thread-33752.html)



convert digits until a non-digit - Skaperen - May-23-2021

i want to convert a string of digits (with maybe one fraction point for float) to a numeric and stop at the first digit that is not convertible so the caller gets the converted numeric value and how many digits were converted. maybe it would be a function that returns a 2-tuple or named sequence or some other way. does Python have anything built-in?