Re: Join strings - very simple Q. ERRATA

2007-03-25 Thread Paulo da Silva
Paulo da Silva escreveu: > John Machin escreveu: >> On Mar 25, 12:32 am, Paulo da Silva <[EMAIL PROTECTED]> wrote: >>> John Machin escreveu: > ... ... > knowledge. If you feel that it is a question that deserves the > honour of your response, just do it. Write it on the stones and > send them down

Re: Join strings - very simple Q.

2007-03-25 Thread Gabriel Genellina
En Sun, 25 Mar 2007 15:31:46 -0300, Paulo da Silva <[EMAIL PROTECTED]> escribió: > John Machin escreveu: >> On Mar 25, 12:32 am, Paulo da Silva <[EMAIL PROTECTED]> wrote: >>> John Machin escreveu: >> [e.g. it's easy to miss the one line in the >> "official" Python tutorial that refers to them]

Re: Join strings - very simple Q.

2007-03-25 Thread Paulo da Silva
John Machin escreveu: > On Mar 25, 12:32 am, Paulo da Silva <[EMAIL PROTECTED]> wrote: >> John Machin escreveu: .. > What was not obvious was (1) if you have been using Python for a > while, how you managed to be unaware of str methods (2) if you are a > newbie, how you managed to find out about t

Re: Join strings - very simple Q.

2007-03-25 Thread Paulo da Silva
Dustan escreveu: > On Mar 24, 7:16 am, Paulo da Silva <[EMAIL PROTECTED]> wrote: >> Dustan escreveu: >> >> >> >>> On Mar 23, 1:30 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: Mike Kent escreveu: ... > New way: > l=['a','b','c'] > jl=','.join(l) I thank you all. Almo

Re: Join strings - very simple Q.

2007-03-24 Thread Michael Bentley
On Mar 25, 2007, at 6:33 AM, Dennis Lee Bieber wrote: > On Sat, 24 Mar 2007 10:53:20 +0200, "Hendrik van Rooyen" > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> >> What happened in 1850 to make it the demarcation line? >> > Well... The Modified Julian Date zero is 17

Re: Join strings - very simple Q.

2007-03-24 Thread Alex Martelli
Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: > "Steven D'Aprano" <[EMAIL PROTECTED]> wrote: > > > > On Fri, 23 Mar 2007 13:15:29 -0700, John Machin wrote: > > > > > OK, I'll bite: This was "new" in late 2000 when Python 2.0 was > > > released. Where have you been in the last ~6.5 years? > >

Re: Join strings - very simple Q.

2007-03-24 Thread Hendrik van Rooyen
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote: > On Fri, 23 Mar 2007 13:15:29 -0700, John Machin wrote: > > > OK, I'll bite: This was "new" in late 2000 when Python 2.0 was > > released. Where have you been in the last ~6.5 years? > > Western civilization is 6,000 years old. Anything after 1850

Re: Join strings - very simple Q.

2007-03-24 Thread John Machin
On Mar 25, 12:32 am, Paulo da Silva <[EMAIL PROTECTED]> wrote: > John Machin escreveu: > .. > > > > > Python 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit (Intel)] on > > win32 > > Type "help", "copyright", "credits" or "license" for more information. > > | >>> help("".join) > > Help on built-in f

Re: Join strings - very simple Q.

2007-03-24 Thread Max Erickson
"7stud" <[EMAIL PROTECTED]> wrote: > On Mar 24, 8:30 am, Duncan Booth <[EMAIL PROTECTED]> > wrote: >> In case you are feeling that the ','.join(l) looks a bit >> jarring, be aware that there are alternative ways to write it. >> You can call the method on the class rather than the instance: >> >>

Re: Join strings - very simple Q.

2007-03-24 Thread Duncan Booth
"Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > 7stud schrieb: >> When I try the latter example, I get an error: >> >> lst = ["hello", "world"] >> print unicode.join(u"\u00d7", lst) >> >> Traceback (most recent call last): >> File "test1.py", line 2, in ? >> print unicode.join(u"\u00d7", l

Re: Join strings - very simple Q.

2007-03-24 Thread Diez B. Roggisch
7stud schrieb: > On Mar 24, 8:30 am, Duncan Booth <[EMAIL PROTECTED]> wrote: >> In case you are feeling that the ','.join(l) looks a bit jarring, be aware >> that there are alternative ways to write it. You can call the method on the >> class rather than the instance: >> >>jl = str.join(',', l)

Re: Join strings - very simple Q.

2007-03-24 Thread 7stud
On Mar 24, 8:30 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > In case you are feeling that the ','.join(l) looks a bit jarring, be aware > that there are alternative ways to write it. You can call the method on the > class rather than the instance: > >jl = str.join(',', l) >jl = unicode.joi

Re: Join strings - very simple Q.

2007-03-24 Thread Dustan
On Mar 24, 7:16 am, Paulo da Silva <[EMAIL PROTECTED]> wrote: > Dustan escreveu: > > > > > On Mar 23, 1:30 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: > >> Mike Kent escreveu: > >> ... > > >>> New way: > >>> l=['a','b','c'] > >>> jl=','.join(l) > >> I thank you all. > > >> Almost there ... > >> I

Re: Join strings - very simple Q.

2007-03-24 Thread Paulo da Silva
Steven D'Aprano escreveu: > On Fri, 23 Mar 2007 13:15:29 -0700, John Machin wrote: > > > Western civilization is 6,000 years old. After reading that post I wouldn't talk about civilization, western or any other :-) Regards. Paulo -- http://mail.python.org/mailman/listinfo/python-list

Re: Join strings - very simple Q.

2007-03-24 Thread Paulo da Silva
Dustan escreveu: > On Mar 23, 1:30 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: >> Mike Kent escreveu: >> ... >> >>> New way: >>> l=['a','b','c'] >>> jl=','.join(l) >> I thank you all. >> >> Almost there ... >> I tried "".join(l,',') but no success ... :-( >> >> Paulo > > Perhaps you're doing it

Re: Join strings - very simple Q.

2007-03-24 Thread Paulo da Silva
John Machin escreveu: .. > Python 2.2.3 (#42, May 30 2003, 18:12:08) [MSC 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > | >>> help("".join) > Help on built-in function join: > > join(...) > S.join(sequence) -> string > > Return a st

Re: Join strings - very simple Q.

2007-03-24 Thread Duncan Booth
"Dustan" <[EMAIL PROTECTED]> wrote: > Perhaps you're doing it wrong, despite having an example right in > front of you? > > Side by side comparison: > jl=string.join(l,',') > jl=','.join(l) > > The sequence is passed as an argument to the join method, and the > delimiter is the string whose metho

Re: Join strings - very simple Q.

2007-03-24 Thread Shane Geiger
import string def test_join(l): print "Joining with commas: ", string.join(l,',') print "Joining with empty string: ", string.join(l,'') print "Joining same way, using another syntax: ", ''.join(l) print "Joining with the letter X: "

Re: Join strings - very simple Q.

2007-03-24 Thread Dustan
On Mar 24, 5:59 am, "Dustan" <[EMAIL PROTECTED]> wrote: > On Mar 23, 1:30 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: > > > Mike Kent escreveu: > > ... > > > > New way: > > > l=['a','b','c'] > > > jl=','.join(l) > > > I thank you all. > > > Almost there ... > > I tried "".join(l,',') but no succe

Re: Join strings - very simple Q.

2007-03-24 Thread Dustan
On Mar 23, 1:30 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: > Mike Kent escreveu: > ... > > > New way: > > l=['a','b','c'] > > jl=','.join(l) > > I thank you all. > > Almost there ... > I tried "".join(l,',') but no success ... :-( > > Paulo Perhaps you're doing it wrong, despite having an examp

Re: Join strings - very simple Q.

2007-03-23 Thread Steven D'Aprano
On Fri, 23 Mar 2007 13:15:29 -0700, John Machin wrote: > OK, I'll bite: This was "new" in late 2000 when Python 2.0 was > released. Where have you been in the last ~6.5 years? Western civilization is 6,000 years old. Anything after 1850 is "new". *wink* -- Steven. -- http://mail.python.org

Re: Join strings - very simple Q.

2007-03-23 Thread John Machin
On Mar 24, 5:37 am, Paulo da Silva <[EMAIL PROTECTED]> wrote: > Hi! > > I was told in this NG that string is obsolet. I should use > str methods. > > So, how do I join a list of strings delimited by a given > char, let's say ','? > > Old way: > > l=['a','b','c'] > jl=string.join(l,',') > > New way?

Re: Join strings - very simple Q.

2007-03-23 Thread Paulo da Silva
Mike Kent escreveu: ... > New way: > l=['a','b','c'] > jl=','.join(l) > I thank you all. Almost there ... I tried "".join(l,',') but no success ... :-( Paulo -- http://mail.python.org/mailman/listinfo/python-list

Re: Join strings - very simple Q.

2007-03-23 Thread Daniel Nogradi
> > I was told in this NG that string is obsolet. I should use > > str methods. > > > > So, how do I join a list of strings delimited by a given > > char, let's say ','? > > > > Old way: > > > > l=['a','b','c'] > > jl=string.join(l,',') > > > > New way? > > Dunno if it's the "new way", but you can

Re: Join strings - very simple Q.

2007-03-23 Thread Paul Rudin
Paul Rudin <[EMAIL PROTECTED]> writes: > Paulo da Silva <[EMAIL PROTECTED]> writes: > >> Hi! >> >> I was told in this NG that string is obsolet. I should use >> str methods. >> >> So, how do I join a list of strings delimited by a given >> char, let's say ','? >> >> Old way: >> >> l=['a','b','c']

Re: Join strings - very simple Q.

2007-03-23 Thread Mike Kent
On Mar 23, 2:37 pm, Paulo da Silva <[EMAIL PROTECTED]> wrote: > Hi! > > I was told in this NG that string is obsolet. I should use > str methods. > > So, how do I join a list of strings delimited by a given > char, let's say ','? > > Old way: > > l=['a','b','c'] > jl=string.join(l,',') > > New way?

Re: Join strings - very simple Q.

2007-03-23 Thread Paul Rudin
Paulo da Silva <[EMAIL PROTECTED]> writes: > Hi! > > I was told in this NG that string is obsolet. I should use > str methods. > > So, how do I join a list of strings delimited by a given > char, let's say ','? > > Old way: > > l=['a','b','c'] > jl=string.join(l,',') > > New way? Dunno if it's th

Join strings - very simple Q.

2007-03-23 Thread Paulo da Silva
Hi! I was told in this NG that string is obsolet. I should use str methods. So, how do I join a list of strings delimited by a given char, let's say ','? Old way: l=['a','b','c'] jl=string.join(l,',') New way? Thanks Paulo -- http://mail.python.org/mailman/listinfo/python-list