How does .join work in Python? -


i want display each row of sql query result on webpage. found code, don't understand line does.

u"<br>".join([u"{0}".format(row.combination) row in salt]) 

how .join method give me desired result?

best run python shell , test it, such as:

>>> "x".join (["a", "b", "c"]) 'axbxc' >>> "abc".join (["m"]) 'm' 

the "x" used thing in between values in iterable. next time "abc" used in between, except there 1 value, there no in between needed.

then refer docs per corykramer comment.


Comments