string.join question

Dennis Lee Bieber wlfraed at ix.netcom.com
Thu Oct 3 04:54:54 CEST 2002


mongo57a at comcast.net fed this fish to the penguins on Wednesday 02 
October 2002 06:47 pm:

> Trying to join a string as follows: string.join(['\,'aaa','\],'')

> (the last characters are 2 single quotes).
> I want a character string which looks like 'aaa' (with quotes).
> Anybody know what I'm doing wrong? or if this is possible with
> string.join? Thanks.
> 

        But what are the \'s supposed to be (or did stuff get lost in your 
post).

        Off hand, as it is quoted above, your have an open quote, \, comma, 
close quote, aaa (which is not inside a string so what is Python 
supposed to be doing), open quote, comma, close quote, \]...

>>> print string.join(['','aaa',''],"'")
'aaa'


>>> aaa = "A long string of nothing"
>>> print string.join(['',aaa,''],"'")
'A long string of nothing'

--
 > ============================================================== <
 >   wlfraed at ix.netcom.com  | Wulfraed  Dennis Lee Bieber  KD6MOG <
 >      wulfraed at dm.net     |       Bestiaria Support Staff       <
 > ============================================================== <
 >        Bestiaria Home Page: http://www.beastie.dm.net/         <
 >            Home Page: http://www.dm.net/~wulfraed/             <



More information about the Python-list mailing list