I'm reading a python book. It's explaining for loops and range() function.
But I don't understand what does '+ and +' mean.
for i in range(7):
print('hello('+str(i)+')')
Actually it should read as:
string_a + string_b + string_c
It is not about "+ xxx +".
It literally concatenate string_a, string_b and string_c together albeit it is not pythonic.
A more pythonic way may be:
print( "hello({my_var})".format(my_var=i) )
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.