list manipulation

Mike Driscoll kyosohma at gmail.com
Tue Apr 22 23:25:14 EDT 2008


John Machin wrote:
> Mike Driscoll wrote:
>
>> Well you could always do something like this:
>>
>> output = ';'.join(roadList)
>>
>> Which will put single quotes on the ends.
>
> No, it doesn't. You are conflating foo and repr(foo).
>
>  I suppose if you want to be
>> silly, you could do this:
>>
>> output = '"%s"' % ';'.join(roadList)
>
> *IF* your first effort were to put single quotes on the ends 
> ('the-text') then your second effort would certainly produce something 
> silly  ... either '"the-text"' or "'the-text'" depending on which of 
> the assignment or the join method you imagined was producing the 
> single quotes.
> -- 
> http://mail.python.org/mailman/listinfo/python-list
Well, in IDLE's output, it looked like what the OP wanted and the OP 
seemed to find my examples helpful. Besides, you did almost the exact 
same thing in your final example.

Mike



More information about the Python-list mailing list