Use more efficient way to concatenate strings in Python