python str + int

TypeError: cannot concatenate 'str' and 'int' objects

1.  print 'Is your secret number " + str(p) + "?"
2. print 'Is your secret number %d?"%p
(for multiple integers, you can '%d %d %d'%(num1, num2, num3)
3. print 'Is your secret number {0}?".format(p)
posted @ 2015-06-06 12:22  carlo-z  阅读(979)  评论(0编辑  收藏  举报