Re: Split function for host:port in standard lib

2008-08-27 Thread Hartmut Goebel
Michael Ströder schrieb: Examples IPv6 addresses: '::1:389' -> ('::1',389) '::1' -> ('::1',None) These are wrong, see http://tools.ietf.org/html/rfc2732 ("Format for Literal IPv6 Addresses in URL's§). Correct formats are: [::1]:389 [::1] -- http://mail.python.org/mailman/listinfo/python-lis

Re: Split function for host:port in standard lib

2008-08-26 Thread Michael Ströder
Manuel Ebert wrote: On Aug 26, 2008, at 1:31 PM, Michael Ströder wrote: Is there a function in the standard lib which can be used to split a string containg 'host:port' into a tuple (host,port) and also does this reliably for IPv6 addresses? > AFAIK port names cannot contain any colons, so pyt

Re: Split function for host:port in standard lib

2008-08-26 Thread Manuel Ebert
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 AFAIK port names cannot contain any colons, so python2.5's 'host:port' .rsplit(':') should do the job. On < 2.5 you probably need to do something like s = addr.rindex(':') host, port = addr[:s], addr[s+1:] Best, Manuel On Aug 26, 2008, at 1:31

Re: split function

2005-08-23 Thread Bengt Richter
On Mon, 22 Aug 2005 22:14:55 +0200, Mohammed Altaj <[EMAIL PROTECTED]> wrote: > >Dear all > >Sorry , I confused between two things , what i said in the last e-mail i >already managed to do using C code , But what i need to do using python >is : my input data : > >0 2 3 4 >1 2 4 >2 3 >3 4 > >what

Re: split function

2005-08-23 Thread bruno modulix
Mohammed Altaj wrote: > Dear all > > Sorry , I confused between two things , what i said in the last e-mail i > already managed to do using C code , But what i need to do using python > is : my input data : > > 0 2 3 4 > 1 2 4 > 2 3 > 3 4 > > what i suppose to do is , using the first line and

Re: split function

2005-08-23 Thread bruno modulix
Mohammed Altaj wrote: > Dear All > > What i want to do is , my input is like > 0 2 > 0 3 > 0 4 > 1 2 > 1 4 > 2 3 > 3 4 > > I am comparing and put the number in group , like ,the first three lines > , all has zero as first input for each line, so the out put should look > like > 0 2 3 4 > and so o

Re: split function

2005-08-22 Thread rafi
Mohammed Altaj wrote: > Dear All > > What i want to do is , my input is like > 0 2 > 0 3 > 0 4 > 1 2 > 1 4 > 2 3 > 3 4 > > I am comparing and put the number in group , like ,the first three lines > , all has zero as first input for each line, so the out put should look > like > 0 2 3 4 > and so o

Re: split function

2005-08-22 Thread William Park
Mohammed Altaj <[EMAIL PROTECTED]> wrote: > > Dear All > > What i want to do is , my input is like > 0 2 > 0 3 > 0 4 > 1 2 > 1 4 > 2 3 > 3 4 > > I am comparing and put the number in group , like ,the first three lines > , all has zero as first input for each line, so the out put should look > li

Re: split function

2005-08-22 Thread Peter Hansen
Mohammed Altaj wrote: > I am reading data from file using readlines() to list , my question > is how to deal with space between any two numbers , I mean , my data What do you mean by "deal with"? Please describe the input and the desired output, or what operations you are trying to perform,