203k views
3 votes
Mainlist=['list1','list2','list3'] ad={ 'list1':[['bsby6m'], ['bloomberg 6month short term ba'], ['1.762740'], ['usd'], ['05/02/2022']], 'list2':[['bsby3m'], ['bloomberg 3month short term ba'], ['1.176640'], ['usd'], ['05/02/2022']], 'list3':[['bsby1m'], ['bloomberg 1month short term ba'], ['.682180'], ['usd'], ['05/02/2022']] }

User Qkx
by
8.0k points

1 Answer

2 votes
To access the first element of the list in 'list1', you can use the following code:

```
Mainlist[0][0]
```

This will return the string 'list1'.

To access the first element of the nested list in 'list1', you can use the following code:

```
ad['list1'][0][0]
```

This will return the string 'bsby6m'.
User Dspencer
by
8.1k points