Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

access dictionary in f string

# Here the quotes in the dictionary lookup are the same as the ones from 
# the string start and end, so instead we need to switch some around 
print(f'{dictionary['key']}')

# Either of these work instead:
print(f"{dictionary['key']}")
print(f'{dictionary["key"]}')
 
PREVIOUS NEXT
Tagged: #access #dictionary #string
ADD COMMENT
Topic
Name
8+5 =