Creating a tuple, as you describe in a loop, is not a great choice, as they are immutable.
This means that every time you add a new row to your tuple, you really create a new tuple with the same values ββas the old one, plus your new row. This is ineffective and should generally be avoided.
If you only need to refer to strings by index, you can use a list:
lines = [] for line in inFile: lines.append(line) print lines[3]
If you really need a tuple, you can drop it after you are done:
lines = tuple(lines)
source share