Python - create attributes


/ Published in: Python
Save to your folder(s)



Copy this code and paste it in your HTML
  1. class Demo: pass # Oggetto contenitore
  2.  
  3. def createAttributes():
  4. rc = Demo()
  5.  
  6. setattr(rc, 'myobj', 'valore')
  7.  
  8. return rc

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.