Python - Return integer value for list enumeration
<p>Is there a cleaner way to get an integer value of the position of a list item in this code:</p>

<pre><code>a = ['m', 'rt', 'paaq', 'panc']
loc = [i for i, x in enumerate(a) if x == 'rt']
loc_str = str(loc).strip('[]')
loc_int = int(loc_str)
id_list = a[loc_int + 1:]
print id_list
</code></pre>

<p>Returns all items after 'rt' as a list ['paaq', 'panc']</p>

<pre><code>a[a.index('rt') + 1:]
</code></pre>

<p>What this is doing is <a href="https://docs.python.org/2.3/whatsnew/section-slices.html" rel="nofollow">slicing</a> the array, starting at where <code>a.index('rt')</code>. not specifying an end <code>:]</code> means we want until the end of the list.</p>

python enumerate