I want to display each row of a SQL query result on a webpage. I found some code, but I don't understand what this line does.
u"<br>".join([u"{0}".format(row.combination) for row in salt])
How does the .join
method give me the desired result?
I want to display each row of a SQL query result on a webpage. I found some code, but I don't understand what this line does.
u"<br>".join([u"{0}".format(row.combination) for row in salt])
How does the .join
method give me the desired result?
Best to run a python shell and test it, such as:
>>> "x".join (["a", "b", "c"])
'axbxc'
>>> "abc".join (["M"])
'M'
The "x" was used as the thing in between the values in the iterable. Next time "abc" was used in between, except there was only one value, so there was no in between needed.
Then refer to the docs as per CoryKramer comment.