You should change
print item + str(i)
to
print item.rstrip() + str(i)
This will remove any newline characters in the strings received in function
.
A couple of other tips:
A better way to print data is to use the
.format
method, e.g. in your case:print '{}{}'.format(item.strip(), i)
This method is very flexible if you have a more complicated task.
All rows read from a file are strings - you don't have to call
str()
on them.