I try to see when I click navbar then I want to see the topic, but it is showing the topic under navbar. I try to give margin, but it doesn't work. Is someone help me with how can I solve this problem.

[Web site showing like that](https://i.stack.imgur.com/g4vki.png)

[But I want to see like that](https://i.stack.imgur.com/WcN46.png)

```
there is code: https://codepen.io/rero34/pen/mdqGyVo

```
['https://Stackoverflow.com/questions/71266586', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/14349341/']
Here is a generator which meets your requirements:

```
def dict_generator(dictionary, previous=None):
    previous = previous[:] if previous else []
    if isinstance(dictionary, dict):
        for key, value in dictionary.items():
            if isinstance(value, dict): 
                for d in dict_generator(value,  previous + [key]):
                    yield d
            elif isinstance(value, list) or isinstance(value, tuple):
                for k,v in enumerate(value):
                    for d in dict_generator(v, previous + [key] + [[k]]):
                        yield d
            else:
                yield previous + [key, value]
    else:
        yield previous + [dictionary]

mydict ={'foo': {'foo1': [1,2,3], 'foo2': 1}}
print(list(dict_generator(mydict)))

```

Will produce output like this:

```
[['foo', 'foo1', [0], 1], ['foo', 'foo1', [1], 2], ['foo', 'foo1', [2], 3], ['foo', 'foo2', 1]]

```
What almost helped me completely is that piece of code
<https://stackoverflow.com/a/59186999/18018783>

```
def dict_generator(indict, pre=None):
pre = pre[:] if pre else []
if isinstance(indict, dict):
    for key, value in indict.items():
        if isinstance(value, dict):
            for d in dict_generator(value,  pre + [key]):
                yield d
        elif isinstance(value, list) or isinstance(value, tuple):
            for k,v in enumerate(value):
                for d in dict_generator(v, pre + [key] + [k]):
                    yield d
        else:
            yield pre + [key, value]
else:
    yield indict

```

However still there is one exception when it doesn't work as I wish for example when this structure is given

```
{
"foo":{
    "foo1": [1,2,3],
    "foo2": 1
}

```

}
the output of `dict_generator` will be

```
[1, 2, 3, ['foo', 'foo2', 1]]

```

so it doesn't give me a path to the key that has a list as an value since my desired output should look that way:

```
[['foo', 'foo1', [0], 1], ['foo', 'foo2', [1], 2], ['foo', 'foo2, [2], 3], ['foo', 'foo2', 1]]]

```