<p>You're not showing how the response example you shown relates to <code>response1</code> (there is no <code>'TagList'</code> in your example). It looks like <code>response1['TagList']</code> is an empty list.</p>

<p>Otherwise you're on the right track (you can always check your exact case directly in the python shell):</p>

<pre><code>$ python
Python 2.7.12 (default, Jul 01 2016, 15:36:53) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; response = [{u'Value': '2018-06-21', u'Key': 'Deletion_Date'}]
&gt;&gt;&gt; response[0]
{u'Key': 'Deletion_Date', u'Value': '2018-06-21'}
&gt;&gt;&gt; response[0]['Value']
'2018-06-21'
</code></pre>

CC BY-SA 4.0
2018-06-23T08:21:03.127Z
2018-06-23T08:21:03.127Z
Dan Cornilescu
<p>I am getting the output from my previous executions something like this:</p>

<pre><code>[{u'Value': '2018-06-21', u'Key': 'Deletion_Date'}]
</code></pre>

<p>I want to get only 2018-06-21 saved in a variable.</p>

<p>I tried this</p>

<pre><code>deletion_date = response1['TagList'][0]['Value']
</code></pre>

<p>But I am getting error </p>

<pre><code>deletion_date = response1['TagList'][0]['Value']
IndexError: list index out of range
</code></pre>

<p>Could someone help me with this or some alternative solution</p>

<amazon-web-services><python><amazon-rds>
Python Dictionary
Prashast
# Python Dictionary

(Asked by: username_0 on 2018-06-22)

I am getting the output from my previous executions something like this:
[{u'Value': '2018-06-21', u'Key': 'Deletion_Date'}]

I want to get only 2018-06-21 saved in a variable.
I tried this
deletion_date = response1['TagList'][0]['Value']

But I am getting error 
deletion_date = response1['TagList'][0]['Value']
IndexError: list index out of range

Could someone help me with this or some alternative solution

**Tags:** amazon-web-services, python, amazon-rds


---

## 1 answers

### Answer by username_1 on 2018-06-23. Score: 1 | Accepted answer

You're not showing how the response example you shown relates to response1 (there is no 'TagList' in your example). It looks like response1['TagList'] is an empty list.
Otherwise you're on the right track (you can always check your exact case directly in the python shell):
$ python
Python 2.7.12 (default, Jul 01 2016, 15:36:53) [GCC] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> response = [{u'Value': '2018-06-21', u'Key': 'Deletion_Date'}]
>>> response[0]
{u'Key': 'Deletion_Date', u'Value': '2018-06-21'}
>>> response[0]['Value']
'2018-06-21'


---

