concatenating strings

EHC erich.pul at blackbox.net
Fri Dec 15 05:49:22 EST 2006


hello!

since i am a py noob, please bear with me ; )

how is it possible to concat a string and an integer in a
print-command? i've tried

print "This robot is named %s. The current speed setting is %d, and %s
has a lifetime of %d" % (self.name , self.speed , self.name)

as well as

print "This robot is named %s. The current speed setting is %d, and %s
has a lifetime of %d" & self.name % self.speed % self.name

though nothing works out...

background is a class named Robot with members speed, name, etc...

tia,
Erich




More information about the Python-list mailing list