[Solved] How to name a file using a value in a list in a dictionary?


Something like this:

dictionary = {'results': [{'name': 'sarah', 'age': '18'}]}
name = dictionary['results'][0]['names'] + '.txt'
open(name, "w")

Opening a file in the write mode, if it doesn’t exist already, will create a new file with that name.

2

solved How to name a file using a value in a list in a dictionary?