Python Forum

Full Version: convert digits until a non-digit
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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?