How to convert 007898989 to 7898989 in Python
<p>I am trying to convert <code>007898989</code> to <code>7898989</code> in Python using the following code:</p>

<pre><code>long(007898989)
</code></pre>

<p>However this leads to the following error:</p>

<pre><code>&gt;&gt;&gt; long(007898989)
  File "&lt;stdin&gt;", line 1
    long(007898989)
                 ^
SyntaxError: invalid token
</code></pre>

<p>How can I convert this number correctly?</p>

<p>Indeed, doing this:</p>

<pre><code>a = 007898989
</code></pre>

<p>will raise the error <code>SyntaxError: invalid token</code>, the easiest way to convert to long would be:</p>

<p><strong>On Python 2</strong></p>

<pre><code>a = long("007898989")
print a
</code></pre>

<p>Trying this cast on python 3 would give <code>NameError: name 'long' is not defined</code>, so, I'd say the best solution is the below one</p>

<p><strong>On python 2/3</strong></p>

<pre><code>a = int("007898989")
print(a)
</code></pre>

python