[Tutor] re

prasad rao prasadaraon50 at gmail.com
Wed Jan 7 10:57:35 CET 2009


Hello
I am trying to get a value as integer and a string.

>>> class Value:
      def __init__(self,inte='',stri=''):
          self.inte=inte
          self.stri=stri
      def setvalue(self,inte='',stri=''):
         self.stri=str(self.inte)
         self.inte=int(self.stri)


>>> v=Value(45)
>>> print v.stri

>>> v.inte
45
>>> v.stri
''
>>> c=Value('36')
>>> c.stri
''
>>>
But it is not converting.How can I do it?

Prasad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090107/f4e87198/attachment.htm>


More information about the Tutor mailing list