On Sun, 15 Aug 2010 12:10:10 -0700, Steven Howe wrote: >> Strings have a join method for this: >> '\t'.join(someList) >> >> Gary Herron > or maybe: > ----------------------------------------- > res = "" > for item in myList: > res = "%s\t%s" % ( res, item )
Under what possible circumstances would you prefer this code to the built- in str.join method? Particularly since the code isn't even correct, as it adds a spurious tab character at the beginning of the result string. (By the way, your solution, to call res.strip(), is incorrect, as it removes too much.) -- Steven -- http://mail.python.org/mailman/listinfo/python-list