Re: Opposite of split

2010-08-17 Thread News123
On 08/17/2010 05:46 PM, Grant Edwards wrote: > On 2010-08-17, Neil Cerutti wrote: >> On 2010-08-17, Stefan Schwarzer wrote: >>> Hi Alex, >>> >>> On 2010-08-16 18:44, Alex van der Spek wrote: Anybody catches any other ways to improve my program (attached), you are most welcome. Help me

Re: Opposite of split

2010-08-17 Thread Grant Edwards
On 2010-08-17, Neil Cerutti wrote: > On 2010-08-17, Stefan Schwarzer wrote: >> Hi Alex, >> >> On 2010-08-16 18:44, Alex van der Spek wrote: >>> Anybody catches any other ways to improve my program (attached), you are >>> most welcome. Help me learn, that is one of the objectives of this >>> new

Re: Opposite of split

2010-08-17 Thread Neil Cerutti
On 2010-08-17, Stefan Schwarzer wrote: > Hi Alex, > > On 2010-08-16 18:44, Alex van der Spek wrote: >> Anybody catches any other ways to improve my program (attached), you are >> most welcome. Help me learn, that is one of the objectives of this >> newsgroup, right? Or is it all about exchanging

Re: Opposite of split

2010-08-17 Thread Stefan Schwarzer
Hi Alex, On 2010-08-16 18:44, Alex van der Spek wrote: > Anybody catches any other ways to improve my program (attached), you are > most welcome. Help me learn, that is one of the objectives of this > newsgroup, right? Or is it all about exchanging the next to impossible > solution to the never

Re: Opposite of split

2010-08-16 Thread John Posner
On 8/16/2010 12:44 PM, Alex van der Spek wrote: Anybody catches any other ways to improve my program (attached), you are most welcome. 1. You don't need to separate out special characters (TABs, NEWLINEs, etc.) in a string. So: bt='-999.25'+'\t''-999.25'+'\t''-999.25'+'\t''-999.25'+'\t'+'

Re: Opposite of split

2010-08-16 Thread D'Arcy J.M. Cain
On Mon, 16 Aug 2010 18:44:08 +0200 "Alex van der Spek" wrote: > Perhaps the ones here who think I was trying to make you do my homework can You keep replying to my message but as I pointed out in my previous message, I'm not the one who thought that you posted a homework question. I'm the one w

Re: Opposite of split

2010-08-16 Thread D'Arcy J.M. Cain
On Mon, 16 Aug 2010 18:26:46 +0200 "Alex van der Spek" wrote: > Nope, no homework. This was a serious question from a serious but perhaps > simple physicist who grew up with Algol, FORTRAN and Pascal, taught himself > VB(A) and is looking for a replacement of VB and finding that in Python. You

Re: Opposite of split

2010-08-16 Thread Alex van der Spek
Perhaps the ones here who think I was trying to make you do my homework can actually help me for real. Since I run my own company (not working for any of the big ones) I can't afford official training in anything. So I teach myself, help is always welcome and sought for. If that feels like doing

Re: Opposite of split

2010-08-16 Thread Alex van der Spek
Thanks much, Nope, no homework. This was a serious question from a serious but perhaps simple physicist who grew up with Algol, FORTRAN and Pascal, taught himself VB(A) and is looking for a replacement of VB and finding that in Python. You can guess my age now. Most of my work I do in R nowa

Re: Opposite of split

2010-08-15 Thread Steven D'Aprano
On Sun, 15 Aug 2010 19:58:54 -0400, Roy Smith wrote: > Actually, > there is (at least) one situation where this produces the correct > result, can you find it? When myList is empty, it correctly gives the empty string. -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Opposite of split

2010-08-15 Thread D'Arcy J.M. Cain
On 15 Aug 2010 23:33:10 GMT Steven D'Aprano wrote: > Under what possible circumstances would you prefer this code to the built- > in str.join method? I assumed that it was a trap for someone asking for us to do his homework. I also thought that it was a waste of time because I knew that twenty p

Re: Opposite of split

2010-08-15 Thread Roy Smith
In article <4c687936$0$11100$c3e8...@news.astraweb.com>, Steven D'Aprano wrote: > On Sun, 15 Aug 2010 12:10:10 -0700, Steven Howe wrote: > > >> Strings have a join method for this: > >> '\t'.join(someList) > >> > >> Gary Herron > > or maybe: > > - >

Re: Opposite of split

2010-08-15 Thread Steven D'Aprano
On Sun, 15 Aug 2010 12:10:10 -0700, Steven Howe wrote: >> Strings have a join method for this: >> '\t'.join(someList) >> >> Gary Herron > or maybe: > - > res = "" > for item in myList: > res = "%s\t%s" % ( res, item ) Under what possible circums

Re: Opposite of split

2010-08-15 Thread Steven Howe
On 08/15/2010 11:35 AM, Gary Herron wrote: On 08/15/2010 11:24 AM, Alex van der Spek wrote: Looking for a method that does the opposite of 'split', i.e. elements in a list are automatically concatenated with a user selectable spacer in between e.g. '\t'. This is to prepare

Re: Opposite of split

2010-08-15 Thread Gary Herron
On 08/15/2010 11:24 AM, Alex van der Spek wrote: Looking for a method that does the opposite of 'split', i.e. elements in a list are automatically concatenated with a user selectable spacer in between e.g. '\t'. This is to prepare lines to be written to a sequential fi

Re: Opposite of split

2010-08-15 Thread Wieland Hoffmann
On 15.08.2010 20:24, Alex van der Spek wrote: > Looking for a method that does the opposite of 'split', i.e. elements in > a list are automatically concatenated with a user selectable spacer in > between e.g. '\t'. >>> " ".join(["

Opposite of split

2010-08-15 Thread Alex van der Spek
Looking for a method that does the opposite of 'split', i.e. elements in a list are automatically concatenated with a user selectable spacer in between e.g. '\t'. This is to prepare lines to be written to a sequential file by 'write'. All hints welcome. Regards