[Tutor] simple problem
Sean 'Shaleh' Perry
shalehperry@attbi.com
Fri, 05 Jul 2002 14:46:39 -0700 (PDT)
On 05-Jul-2002 Kyle Babich wrote:
> I know this is simple, but I can find the answer in the documentation
> (although I guess it has to be there somewhere).
> Please bear with me because if you've read any of my messages you know
> I'm a complete newbie to python.
>
> I know how to do something like:
> myname = "Kyle"
> print "Hello, my name is", myname
>
> But how would I call up the myname variable in the middle of the print
> command?
> (Ie. print "Hello, #myname variable here# where do you live?"
> ---
myname = 'Sean'
person = 'Kyle'
a) print "Hello, " + person + " my name is " + myname
b) print "Hello, %s my name is %s" % (person, myname)
c) print "Hello, ", person, " my name is ", myname
I tend to prefer b, many people use a. C is kind of frowned on.