How to print the variable?

Paul McGuire ptmcg at austin.rr.com
Wed Feb 14 09:26:41 EST 2007


On Feb 14, 8:00 am, Jean-Paul Calderone <exar... at divmod.com> wrote:
> On Wed, 14 Feb 2007 05:47:31 -0800 (PST), Hans Schwaebli <hans_schwae... at yahoo.com> wrote:
> >Hi,
>
> >  am am a Python beginner with Java knowledge background. Infact I need to use Jython.
>
> >  My first beginner question is how to determine of what type a variable is?
>
> >  In program which supports Jython there is a variable called "rc" available. I can use the methods on that variable like rc.logMessage("hello"). But if I try to execute "print "${rc}" it tells me "Invalid variable syntax for attribute 'code' with value 'print "${rc}".'
>
>   print rc
>   print dir(rc)
>   print type(rc)
>   help(rc)
>
>  http://python.org/doc/tut/
>
> Jean-Paul

print "The variable rc has the value %s" % rc
print "The variable rc has the value %(rc)s" % locals()

-- Paul




More information about the Python-list mailing list