have files with date attached in last part of filename. Like this.

```
string = 'blablablabla_20210812.jpg'

```

I extract that data like this.

```
string[-12:][:-4]

```

I want to add '-' between year, month and date. This is how I do.

```
string[-12:][:-4][:4] + '-' + string[-12:][:-4][4:][:2] + '-' + string[-12:][:-4][6:]

```

In my opinion, it seems like more complicated than reading machine code. Could you guys could enlighten me the ways which are more pragmatic?