211
281
This really applies to any area of your code that involves a lot of string joining.
216
286
>>> file.write(str1 + " " + str2 + " " + str3 + "\n")
221
291
>>> file.write("%s %s %s\n" % (str1, str2, str3))
226
296
>>> file.write(" ".join([str1, str2, str3, "\n"]))
299
join is fastest on many strings, `string formatting <http://docs.python.org/py3k/library/string.html#string-formatting>`_ is quite fast too (better for converting data types). String arithmetic is slowest.
232
302
Parsing Strings (Import/Exporting)