python中的字符串和数字连接

1. 将数字强制转换成字符串

i = 1000
str1 = "hello"

print str1 + str(i)

2. 格式化成字符串

i = 1000
str1 = "hello"

print "%s %d" %(str1, i)
原文地址:https://www.cnblogs.com/XXCXY/p/5177862.html