3 Answers

  1. Elliott- Reply

    2019-11-14

    Try this code.

    data = [{"15400001": [0, 7, 603, 607, 1655, 1661, 1703, 1706, 1823, 1825, 1826, 1827, 2423, 2471, 2475, 2477]}]
    
    print(data[0]["15400001"])
    

    Output :

    [0, 7, 603, 607, 1655, 1661, 1703, 1706, 1823, 1825, 1826, 1827, 2423, 2471, 2475, 2477]
    
  2. Elvis- Reply

    2019-11-14

    This is basic of list AND dictionary :-

    data = [{"15400001": [0, 7, 603, 607, 1655, 1661, 1703, 1706, 1823, 1825, 1826, 1827, 
               2423, 2471, 2475, 2477]}]
    my_dict = data[0]  # Getting 0 position of list AND in output we will get dictionary
    my_dict['15400001']  # Getting value in dictionary from key.
    
    • Here we have data which is of list type.
    • Now we are iterating the 0 position of data list AND in output we will get dictionary.
    • Now get values corresponding to key 15400001, make sure that 15400001 should be string.

    Output

    [0, 7, 603, 607, 1655, 1661, 1703, 1706, 1823, 1825, 1826, 1827, 2423, 2471, 2475, 2477]
    

    I hope it may help you.

  3. Eric- Reply

    2019-11-14

    You can use :

    data[0]["15400001"]
    

Leave a Reply

Your email address will not be published. Required fields are marked *

You can use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>