You can use: print "<img src=%s.jpg>" % (number) or print "<img src="+str(number)+".jpg>" or a number of others, but for short strings one of these two generally work fine.