String and quotation marks

Discussion in 'Python' started by M. Clift, Oct 22, 2004.

  1. M. Clift

    M. Clift Guest

    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']

    # flatten names

    for i in names:
    h = map(None, ab)

    l1 = []
    for i in h:
    for j in list(i):
    l1.append(j)
    x = "".join(l1)


    print x,
    # - gives of course cat egg girl cow

    printnames = " \"x\"" # -- I've tried this, but it doesn't work


    self.label_1 = wx.StaticText(self, -1, printnames)

    Could someone show me how to get some quotes around the string so I can use
    it for the static text?

    Thanks,

    Malcolm
     
    M. Clift, Oct 22, 2004
    #1
    1. Advertisements

  2. M. Clift

    Larry Bates Guest

    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
     
    Larry Bates, Oct 22, 2004
    #2
    1. Advertisements

  3. M. Clift

    M. Clift Guest

    Thanks Larry!

    Hi Larry,

    Thanks, perfect.

    Malcolm
     
    M. Clift, Oct 22, 2004
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Radith

    Using quotation marks

    Radith, Jan 7, 2005, in forum: Java
    Replies:
    1
    Views:
    562
  2. Replies:
    0
    Views:
    726
  3. Tristan Miller
    Replies:
    54
    Views:
    1,768
    ???????? ????? ???????????
    Nov 6, 2003
  4. Peng Yu

    Question about concatenating quotation marks

    Peng Yu, Oct 1, 2004, in forum: C Programming
    Replies:
    3
    Views:
    434
    Mark McIntyre
    Oct 2, 2004
  5. Junior
    Replies:
    4
    Views:
    488
    Dennis Lee Bieber
    Oct 27, 2007
  6. Vadim
    Replies:
    1
    Views:
    1,652
    Pascal J. Bourguignon
    Dec 24, 2008
  7. new
    Replies:
    4
    Views:
    388
    Aaron Bertrand - MVP
    Jul 8, 2003
  8. Peter Bunyan
    Replies:
    5
    Views:
    346
    Andrew Stewart
    Mar 20, 2008
Loading...