Something like this:
dictionary = {'results': [{'name': 'sarah', 'age': '18'}]}
name = dictionary['results'][0]['names'] + '.txt'
open(name, "w")
Opening a file in the w
rite mode, if it doesn’t exist already, will create a new file with that name.
More Related Contents:
- How do I convert two lists into a dictionary?
- Convert [key1,val1,key2,val2] to a dict?
- Remove duplicate dict in list in Python
- How to avoid “RuntimeError: dictionary changed size during iteration” error?
- list to dictionary conversion with multiple values per key?
- How to overcome TypeError: unhashable type: ‘list’
- How can I convert a dictionary into a list of tuples?
- List of dicts to/from dict of lists
- Appending a dictionary to a list – I see a pointer like behavior
- merging Python dictionaries
- Converting Dictionary to List? [duplicate]
- How to find the min/max value of a common key in a list of dicts?
- Converting a list of tuples into a dict
- Make dictionary from list with python [duplicate]
- Get a list of values from a list of dictionaries?
- Remove dictionary from list
- How do I sort this list in Python, if my date is in a String?
- How do I extract all the values of a specific key from a list of dictionaries?
- How do I return dictionary keys as a list in Python?
- Why can’t I use a list as a dict key in python? Exactly what can and cannot be used, and why?
- convert csv file to list of dictionaries
- What are dict_keys, dict_items and dict_values?
- How do I send list of dictionary as Body parameter in FastAPI?
- Python The appended element in the list changes as its original variable changes
- Use endswith with multiple extensions
- How can I convert string values from a dictionary, into int/float datatypes?
- Python Accessing Values in A List of Dictionaries
- How do I send list of dictionary as Body parameter together with Files in FastAPI?
- How to convert only numbers in a mixed list into float
- In what case would I use a tuple as a dictionary key? [closed]