Jun-24-2019, 07:23 PM
Generally speaking, you should simplify your code before asking a question about it. In this case, SQL is not related to this question, so everything about it can be removed. Really your question comes down to this:
Now to actually answer your question... if you know that the Population key is always going to present, and it's the only thing you care about, you can do this
Simplified-question asker Wrote:I'm struggling with printing a dictionary in a specific way. Here's my code:
data = {"Population": 92020} print(data)Actual result: {"Population": 92020}
Desired result: Population 92020
Now to actually answer your question... if you know that the Population key is always going to present, and it's the only thing you care about, you can do this
data = {"Population": 92020} print("Population {Population}".format(**data))or perhaps more directly
data = {"Population": 92020} print("Population {}".format(data["Population"]))