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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:47:38+00:00 2026-06-13T15:47:38+00:00

I have the following method definition in my class: def show_values(self): for node in

  • 0

I have the following method definition in my class:

def show_values(self):
        for node in self.Nodes:
            nod = self.Nodes[node]
            print self.M.nod.value

I receive the following error

File "nfg.py", line 30, in show_values
    print self.M.nod.value
AttributeError: 'Model' object has no attribute 'nod'

I want to reach to self.M.(self.Nodes[node]).value, of course, but do not know
how. Can you help me?

  • 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-06-13T15:47:39+00:00Added an answer on June 13, 2026 at 3:47 pm

    Assuming self.Nodes[node] is a string that you want to use for an attribute lookup, try the following:

    def show_values(self):
        for node in self.Nodes:
            nod = self.Nodes[node]
            print getattr(self.M, nod).value
    

    Note that getattr(foo, 'bar') is equivalent to foo.bar.

    If self.M is a dictionary or other mapping type and you want to do a key lookup, use the following:

    def show_values(self):
        for node in self.Nodes:
            nod = self.Nodes[node]
            print self.M[nod].value
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a the following method definition in my class: virtual Calc* Compile( Evaluator*
I have the following method in my UIButton class: - (id)initWithCoder:(NSCoder *)aDecoder{ self =
I have the following method which is called when the value Edit Class... is
Suppose we have following code defined in tester.py class Tester( object ): def method(
I have written the following class: class myClass(object): def __init__(self): pass def foo(self, arg1,
I have the following class definition. Contact.h #import <CoreData/CoreData.h> @interface Contact : NSManagedObject {
I have the following abstract classes: public abstract class AbSuperClass1<K,S> { //class definition }
Let's have the following class definition: CThread::CThread () { this->hThread = NULL; this->hThreadId =
I have this form.py: from shortcut import get_timezone class HostCreateForm(forms.ModelForm): def save(self, commit=True): host1
I have a base class like this: class base(object): name = def __init__(self,name): self.user

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.