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

  • Home
  • SEARCH
  • 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 4538868
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T14:52:07+00:00 2026-05-21T14:52:07+00:00

Trying to create a batch of dictionaries: January = {} February = {} March

  • 0

Trying to create a batch of dictionaries:

January = {}
February = {}
March = {}

I would rather do something like:
January, February, March… = {}

which of course doesn’t work.

Ultimately, I’m wanting to create a dictionary of these dictionaries:

MONTHS_DICT = {'01':January,'02':February...}

Its not a ton of code to do it line by line but I’m just learning Python and…. doing something repetitive typically tells me it can be done more efficiently in some other way.

Thoughts?

p.s. I’m working with python 2.x but if using 3 for this example would be of some help, that’s not a problem.

  • 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-21T14:52:08+00:00Added an answer on May 21, 2026 at 2:52 pm

    Why do you want to month names as variables if you don’t use them? You could simply write

    month_dicts = [{} for _ in range(12)] # twelve dicts
    numbers = ["%02d" % x for x in range(1,13)] # strings "01" ... "12"
    
    # the dict
    MONTHS_DICT = dict(zip(numbers, month_dicts))
    # the dict for March
    MONTHS_DICT["03"]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a batch script which would perform the same action
I'm trying to create a batch script that will delete all sub directories which
I'm trying to create a batch file which will loop around a list of
I'm trying to create batch file which should have this commands: cd c:\Program files\NuSMV\2.5.2\bin\
I am trying to create a batch script that would connect to a mySQL
I am trying to create a batch file which runs other batch files in
I am trying to create a batch file which will create folders within all
I am trying to create a batch string like this: >abcd_ I have a
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
Trying to create a macro which can be used for print debug messages when

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.