Getattr use wildcard as name parameter python | Unix Linux Forums | Programming

  Go Back    


Programming Post questions about C, C++, Java, SQL, and other programming languages here.

Getattr use wildcard as name parameter python

Programming


Tags
python, snmp

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 03-08-2013
kar_333 kar_333 is offline
Registered User
 
Join Date: Aug 2011
Last Activity: 27 December 2013, 5:23 AM EST
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb Getattr use wildcard as name parameter python

I am trying to extract value from snmp trap oid got from mib, using getattr function in python.

Code:
getattr(evt,1.3.6.1.4.1.755.1.2.3.3.1.1.2

)when i started testing the using real trap OID is having two additional values at the end.

Code:
1.3.6.1.4.1.755.1.2.3.3.1.1.2.**1.2**

so is there a way i can use

Code:
getattr(evt,1.3.6.1.4.1.755.1.2.3.3.1.1.2.*)

I don't want to use the correct OID. it should work in all cases so i wanted to use a wild card. i tried it. but it's not working. If you know any alternatives please help.

Last edited by Scrutinizer; 03-08-2013 at 02:50 AM.. Reason: code tags
Sponsored Links
    #2  
Old 03-08-2013
DGPickett DGPickett is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 15 October 2014, 5:08 PM EDT
Location: Southern NJ, USA (Nord)
Posts: 4,455
Thanks: 8
Thanked 546 Times in 524 Posts
Since getattr requires an exact name string, you may have to iterate a dir() and compare each to your pattern.
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Passing parameter to script, and split the parameter only4satish Shell Programming and Scripting 5 11-01-2012 05:37 AM
Command that takes one parameter and then searches for the passed in parameter pankaj80 Shell Programming and Scripting 3 04-05-2012 06:05 AM
how do I make dynamic parameter names? Or get the value of a parameter evaluated twi Awanka Shell Programming and Scripting 2 04-19-2007 09:37 PM
Find wildcard .shtml files in wildcard directories and removing them- How's it done? Neko UNIX for Dummies Questions & Answers 1 06-27-2001 09:06 AM



All times are GMT -4. The time now is 12:45 PM.