for i in range(0,100):
print(i)
print("item" + i) #如果在输出时添加“item”,则会报错,字符串不匹配
修改 字符串拼接
print("item {0}".format(i))
Update.
print("item {0},{1}".format(i,"hello python")
>>> print("item {0}{1}" . format(2333 , "hello python"))
item 2333hello python
>>> print("item {0},{1}" . format(2333 , "hello python"))
item 2333,hello python
>>> print("item {0} {1}" . format(2333 , "hello python"))
item 2333 hello python
cf : 三种字符串拼接是一样的
print( "%s" % ( "strings"))
print( "{0}" . format("strings")
print( "{name}" . format(name = "bob")