kyosohma at gmail.com
Tue Apr 22 23:09:40 CEST 2008
On Apr 22, 3:55 pm, DataSmash <r... at new.rr.com> wrote:
> I have a list that looks like this:
> roadList = ["Motorways","Local","Arterial"]
> I want to apply some code so that the output looks like this:
> ...in other words, I want each item in the list separated by a ';' and
> then the whole thing surrounded by quotes.
> How can this be done with the LEAST amount of code?
> I appreciate your help!
Well you could always do something like this:
output = ';'.join(roadList)
Which will put single quotes on the ends. I suppose if you want to be
silly, you could do this:
output = '"%s"' % ';'.join(roadList)
More information about the Python-list