Popular recipes tagged "representation", "python", "numbers" and "formats"http://code.activestate.com/recipes/tags/representation+python+numbers+formats/2015-08-04T20:08:29-07:00ActiveState Code RecipesConverting numeric strings to integers (Python)
2015-08-04T20:08:29-07:00Vasudev Ramhttp://code.activestate.com/recipes/users/4173351/http://code.activestate.com/recipes/579093-converting-numeric-strings-to-integers/
<p style="color: grey">
Python
recipe 579093
by <a href="/recipes/users/4173351/">Vasudev Ram</a>
(<a href="/recipes/tags/formats/">formats</a>, <a href="/recipes/tags/numbers/">numbers</a>, <a href="/recipes/tags/numerical/">numerical</a>, <a href="/recipes/tags/python/">python</a>, <a href="/recipes/tags/python2/">python2</a>, <a href="/recipes/tags/representation/">representation</a>).
</p>
<p>This recipe shows how to convert numeric strings into integers, i.e. it emulates the Python int() function - partially. It does not handle negative numbers, floating point numbers, or numbers in other bases than decimal. It is only meant as a simple demo of the steps by which a string containing an integer value, is converted into an actual integer, in Python (and similarly, in other languages).</p>