String Formatting vs. Concatenating : Concatenate « String « Python Tutorial






uid = "sa" 
pwd = "secret" 
print pwd + " is not a good password for " + uid    
print "%s is not a good password for %s" % (pwd, uid)    

userCount = 6 
print "Users connected: %d" % (userCount, )








5.5.Concatenate
5.5.1.Concatenating Strings
5.5.2.String Formatting vs. Concatenating
5.5.3.Runtime String Concatenation