Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4022404
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:28:15+00:00 2026-05-20T10:28:15+00:00

In the follwoing code Maps.objects.all() returns all the objects in the tables and get

  • 0

In the follwoing code Maps.objects.all() returns all the objects in the tables and get description will return two variables namely name,description.

Now my question i am constructing a dicetionary.If the name is not in the dictionary then i should add it.How this should be done.

EDIT
This needs to be done on python2.4

  labels = {}
  maps Maps.objects.all()
  for lm in maps:
     (name,description) = getDescription(lm.name,lm.type)
     if name not in labels:
        labels.update({name,description})
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T10:28:15+00:00Added an answer on May 20, 2026 at 10:28 am

    From what I understand, you’re trying to assign a value to a key in a dictionary if it doesn’t exist. Here’s a helpful page for dictionaries.

    Now, to address your question, this should do what you want:

    labels = {}
    maps = Maps.objects.all()
    for lm in maps:
        name, description = getDescription(lm.name, lm.type)
        if name not in labels:
            labels[name] = description
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Javascript objects can be used as maps. The following all is valid code: var
All, I've got the following code to display my maps: <script type=text/javascript src=http://maps.google.com/maps/api/js?sensor=false></script> <script
All, I've got the following code to display my markers on my maps: <script
I'm using the following code to get the coordinates of my Google maps marker
I have the following code to open google maps: NSString *urlString = [NSString stringWithFormat:@http://maps.google.com/maps?q=%@,
In our Struts2-Spring application we are using the follwoing lines of code access the
I am using following code to show my location on google maps String uri
I have three tables: Person (Id, FirstName) Organization (Id, Name) PersonOrganization (PersonId, OrganizationId, Details)
How do you get Client location using Google Maps API v3? I tried the
I was playing with https://github.com/apneadiving/Google-Maps-for-Rails and i'd like to clear all the marker on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.