python - How can I acces the attributes of a class instance -


i'm trying access attributes of class instance defined inside class keep getting error says there no attribute 'get'.

from selenium import webdriver  class driver:     proxy = [1, 2, 4]      def get_driver(self):         driver = webdriver.firefox()         if self.proxy[0] == 1:             return self  driver = driver() driver.get_driver() driver.get("https://www.youtube.com/watch?v=5xxqs34umx4&index=101&list=plihuzhhwjm2gto_ikmydg7ot1enmmyodl") print driver.proxy 

i can think of few ways access instance's attribute

  1. dir(obj)
  2. obj.__dict__
  3. using ipython's autocomplete - within interactive shell, type obj tab

Comments