F-string are putting the "" inside a {}

54 views Asked by At

My Code:

videos = []
for keys in data:
    videos.append({f"'path: 'videos/{filename}.mp4', 'description': '{filename}'"},)

The problem:

problem

As you can see the f-string is putting the "" inside the {} but i dont want that

1

There are 1 answers

1
Vivaan Singhvi On BEST ANSWER

You were creating a set like this:

{f"'path: 'videos/{filename}.mp4', 'description': '{filename}'"}

This makes the entire thing one big string inside a set. Do this instead:

videos = []
for keys in data:
    videos.append({'path': f'videos/{filename}.mp4', 'description': filename})