String and quotation marks

Larry Bates lbates at syscononline.com
Fri Oct 22 16:36:59 EDT 2004


M. Clift wrote:
> Hi All,
> 
> I'm displaying some static text in wx.python. All is ok if I write the text
> as so;
> 
>  self.label_1 = wx.StaticText(self, -1, " categggirlcow")
> 
> However I have the names as a string without quotes
> 
>         names = ['cat','egg','girl','cow']
> 

names is a list of strings so you just need to join
them together and if your example is correct prepend
a single space.

self.label_1=wxStaticText(self, -1, " "+"".join(names))

This would produce exactly the same string as
" categggirlcow" that you pass in as a literal.

Larry Bates



More information about the Python-list mailing list