RE: better way than: myPage += 'more html' , ...

Discussion in 'Python' started by sismex01@hebmex.com, Jun 25, 2003.

  1. Guest

    > From: Dave Kuhlman [mailto:]
    > Sent: MiƩrcoles, 25 de Junio de 2003 04:08 p.m.
    >
    > -----------8<--------------
    > import string
    > ...
    > htmlPage=["<html><header></header><body>"]
    > htmlPage.append("more html")
    > ....
    > htmlPage.append("more html")
    > ....
    > htmlPage.append("<\body><\html>")
    > # Use string.join() instead of ''.join() to add new-lines.
    > htmlDoc= string.join(htmlPage, '\n')
    > -----------8<--------------
    >
    > Funny that string.join() supports the optional second parameter,
    > while 'abc'.join() does not.
    >
    > - Dave
    >


    That's because string.join() is a module function, and in the
    other case, ".join()" is a method of the string object "abc",
    so in that case, "abc" is the "self" parameter.

    And, in the case of string.join()'s optional second parameter,
    it's default value is "", an empty string (if I'm not mistaken).

    It's the same thing as "".join()

    Salutations!

    -gustavo

    ---

    Advertencia:La informacion contenida en este mensaje es confidencial y
    restringida, por lo tanto esta destinada unicamente para el uso de la
    persona arriba indicada, se le notifica que esta prohibida la difusion de
    este mensaje. Si ha recibido este mensaje por error, o si hay problemas en
    la transmision, favor de comunicarse con el remitente. Gracias.
    , Jun 25, 2003
    #1
    1. Advertising

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. Gobo Borz
    Replies:
    11
    Views:
    1,081
    Chuck Spears
    Jun 26, 2003
  2. Delaney, Timothy C (Timothy)

    RE: better way than: myPage += 'more html' , ...

    Delaney, Timothy C (Timothy), Jun 26, 2003, in forum: Python
    Replies:
    0
    Views:
    655
    Delaney, Timothy C (Timothy)
    Jun 26, 2003
  3. Peter Bencsik
    Replies:
    2
    Views:
    822
  4. Steven D'Aprano
    Replies:
    0
    Views:
    90
    Steven D'Aprano
    Dec 23, 2013
  5. Replies:
    2
    Views:
    52
    Mark H Harris
    May 13, 2014
Loading...

Share This Page