Ask coding questions

← Back to all posts
How do you add something to a replit db?
h
okalisl

So lets say I created a replit db like this:
db['example_db'] = {
'Example_title' : example_value
}

How do I append a value to this db?

Answered by IMayBeMe [earned 5 cycles]
View Answer
Voters
okalisl
Comments
hotnewtop
IMayBeMe

You can do, db[‘example-db’][‘example_title2’] = ‘example_value2’. This should add another item within the dictionary.

okalisl

Thank you so much @IMayBeMe!!!

IMayBeMe

@okalisl no problem!

okalisl

Oh wait @IMayBeMe. It seems like it is overriding the other values. Is there a way to fix this?

IMayBeMe

@okalisl it shouldn’t be as long as the key in the second set of brackets is unique from all the other keys.

okalisl

Oh, @IMayBeMe Thanks!