Variables in strings..

Matthias Huening matthias.huening at univie.ac.at
Mon Jul 24 06:58:06 EDT 2000


Peter Schneider-Kamp <peter at schneider-kamp.de> schrieb in im Newsbeitrag:
397C393F.E4AFEBB4 at schneider-kamp.de...
> Gabriel Ambuehl wrote:
> >
> > print "Hello $name"
> > would do the job. Now the only solution I could find in Python was
> > this awful
> > print "Hello %(name)s" % var()
>
> There is of course:
>
> print "Hello", name
> print "Hello", name[1]
>

... and this:

print "hello %s" % name
print "hello %s" % name[1]


Matthias
--
matthias.huening at univie.ac.at
http://www.ned.univie.ac.at/dt/






More information about the Python-list mailing list