How to use dynamic properties? <-- Noob

S

Sean Schertell

person.name = 'Joe'
person.age = 20
person.sex = 'm'

info_I_need = name

print person.info_I_need

# How can I make it print 'Joe' ?


Sean


:::: DataFly.Net ::::
Complete Web Services
http://www.datafly.net
 
B

Bruno Desthuilliers

Sean Schertell a écrit :
person.name = 'Joe'
person.age = 20
person.sex = 'm'

info_I_need = name

print person.info_I_need

# How can I make it print 'Joe' ?

print getattr(person, "name")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top