I have a Python list and would like to build the ranged loop list. It looks like a ring buffer. So if I have a list:

```
[[0], [1], [2], [3]]

```

I would like to get:

```
[[0], [1], [2], [3]]
[[1], [2], [3], [4]]
[[2], [3], [4], [0]]
[[3], [4], [0], [1]]
[[4], [0], [1], [2]]

```

I could do it by myself. But is there any better or smarter ways in Python 3?

The code I have tried:

```
N = 5
d_list = [[_] for _ in range(N)]
for i in range(N):
    b1 = i
    e1 = i + N - 1
    b2, e2 = 0, 0
    if e1 >= N:
        e2 = e1 - N
    print(d_list[b1:e1] + d_list[b2:e2])

```