class BankAccount(object): def __init__(self, initial_balance=0): self.balance = initial_balance def deposit(self, amount): self.balance += amount def withdraw(self, amount): self.balance -= amount def overdrawn(self): return self.balance < 0 my_account = BankAccount(15) my_account.withdraw(5) print my_account.balance if hasattr(my_account, "withdraw"): print "ITS THERE" test = { "headline":"{{ patient.primary_facility }} patient from {{ patient.referring_physician }}", "type":"default", "text":"<p><strong>H: </strong> {{ patient.home_phone_number }},<strong>W: </strong> {{ patient.work_phone_number }},<strong>C: </strong> {{ patient.cell_phone_number }}<br><a href=\"https://mail.google.com/a/discover-cpc.com/?view=cm&fs=1&tf=1&to={{ patient.email }}&body={{ patient }}\" target=\"_blank\">{{ patient.email }}</a></p>", "asset": { "media": "http://maps.google.com/maps?q={{ patient.get_full_address|urlencode }}", "caption":"{{ patient.get_full_address }}" }, "date": [ { "startDate":'10/4/2011 16:02:00', "headline":"MRI L Spine", "text":"<p>Click here for document</p>", "tag":"Docs,Results", "classname":"optionaluniqueclassnamecanbeaddedhere", "asset": { "media":"", "thumbnail":"/static/unicorn/img/icons/32/pdf.png", "credit":"Credit Name Goes Here", "caption":"Caption text goes here" } }, { "startDate":"10/4/2011", "headline":"Diagnostic Lumbar Medial Branch Block (#1) (Repeat), Left (L3-L4, L4-L5, L5-S1)", "text":"<p>Completed</p>", "tag":"Procedure", "classname":"optionaluniqueclassnamecanbeaddedhere", "asset": { "media":"", "thumbnail":"optional-32x32px.jpg", "credit":"Credit Name Goes Here", "caption":"Caption text goes here" } } ], } temp = 5 import types if isinstance(my_account.withdraw, types.MethodType): print "asdf" def add(): return 2+2 x = add print add
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question