Problem Creating NewLines in PDF

MRAB python at mrabarnett.plus.com
Wed Aug 18 15:02:09 EDT 2010


Andrew Evans wrote:
> Hello yes
> 
> This line doesn't seem to want to accept a list for some strange reason
> 
> 
> story.append(Paragraph(str(result_list), para))
> 
 From the documentation it appears that you need to pass a string.

You're just passing the result of str(result_list), which isn't giving
you what you want:

 >>> result_list = ['hello', 'world']
 >>> print str(result_list)
['hello', 'world']

But what do you want? Do you just want to concatenate the entries into a
single string (assuming they're all strings)?

 >>> print "".join(result_list)
helloworld

Or with some kind of separator between them?

 >>> print " ".join(result_list)
hello world



More information about the Python-list mailing list