Facebook
From kush, 4 Years ago, written in Plain Text.
This paste is a reply to Re: 6 from kush - view diff
Embed
Download Paste or View Raw
Hits: 293
  1. class Person:
  2.     def __init__(self,name, age):
  3.         self.__name = name
  4.         self.__age = age
  5.     def __str__(self):
  6.         return("%s is %s years old" %(self.__name,self.__age))
  7.     @classmethod
  8.     def from_string(cls,person_str):
  9.         l=person_str.split(",")
  10.         cls.__name=l[0]
  11.         cls.__age=int(l[1])
  12.         p=Person(cls.__name,cls.__age)
  13.         return(p)
  14.        
  15.        
  16.  
  17.  
  18.        
  19.  
  20.  

Replies to Re: 7 rss

Title Name Language When
8 kush text 4 Years ago.