[Tutor] about print()

Ryan Wu seasideryan at gmail.com
Mon Jun 6 08:29:08 CEST 2011


Hi all,

I am a newbie of python, and reading 'python essential reference'.

Now I want to print this  results

'a is %d' % a -> a is 42
>

with the code

a = 42
> test = "'a is %d' % a"
> print( '%20s ->' % test, test)
>

but what I get is

>         'a is %d' % a -> 'a is %d' % a
>


What is the difference of  print(test) and print ( 'a is %d' % a )?

Regards
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110606/4ed047e6/attachment.html>


More information about the Tutor mailing list