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 4342316
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T11:36:08+00:00 2026-05-21T11:36:08+00:00

Say I have this piece of code, and I want to execute it on

  • 0

Say I have this piece of code, and I want to execute it on two separate dictionaries. How can I do this easily without writing the code twice? I guess i could def a small function and then pass each dict to it. Are there any better ways?

    for key, value in self.mfiles.iteritems():
        if key not in self.INPUT['extras']:
            self.mfiles[key] = self.dirs['confdir'] + '/' + value

    for key, value in self.nmfiles.iteritems():
        if key not in self.INPUT['extras']:
            self.nmfiles[key] = self.dirs['confdir'] + '/' + value
  • 1 1 Answer
  • 1 View
  • 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-21T11:36:08+00:00Added an answer on May 21, 2026 at 11:36 am

    You can do this:

    for data in (self.mfiles, self.nmfiles):
        for key, value in data.iteritems():
            if key not in self.INPUT['extras']:
                data[key] = self.dirs['confdir'] + '/' + value
    

    However, I think writing a small function is probably clearer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's say I have this piece of code: CGColorSpaceRef colorSpaceRGB = CGColorSpaceCreateDeviceRGB(); CGContextSetStrokeColorSpace(context, colorSpaceRGB);
Say I have this code - public interface ParentInterface1 { public List<? extends ChildInterface1>
Say I have this code: #import <UIKit/UIKit.h> @interface MyView : UIView @end @implementation MyView
Here's my problem: Lets say I have two dictionaries, dict_a and dict_b. Each of
Let's say I have the following piece of code (a simple CRTP class hierarchy).
So I have this piece of code that would return the current EST Date
I need to execute a piece of JavaScript code say, each 2000 milliseconds. setTimeout('moveItem()',2000)
I have a big problem writing a small piece of code using JS/jQuery (don't
I have the following piece of code. It is actually three separate scripts except
I have this piece of code that works very well and gives me the

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.