Answer the question
In order to leave comments, you need to log in
How to get values into a variable from MongoDB?
I know how to get one value:
for x in collection.find_one({"_id": "значение"}):
y = x["..."]
Answer the question
In order to leave comments, you need to log in
Two values like this:
"test": [0, "testt"]look like a list, respectively, they can be accessed as elements of a list by index, or expanded into two variables.
my_data = {"test": [0, "testt"]}
my_test = my_data['test']
print(my_data['test'][0], my_data['test'][1])
first_test, second_test = my_test
print(first_test, second_test)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question