Re: The split() function of Python's built-in module has changed in a puzzling way - is this a bug?

2021-04-23 Thread Dan Stromberg
On Thu, Apr 22, 2021 at 8:53 PM Andy AO wrote: > Upgrading from Python 3.6.8 to Python 3.9.0 and executing unit tests > revealed a significant change in the behavior of re.split(). > > but looking at the relevant documentation — Changelog python.org/3/whatsnew/changelog.html> and

Re: The split() function of Python's built-in module has changed in a puzzling way - is this a bug?

2021-04-23 Thread Thomas Jollans
On 23/04/2021 01:53, Andy AO wrote: Upgrading from Python 3.6.8 to Python 3.9.0 and executing unit tests revealed a significant change in the behavior of re.split(). but looking at the relevant documentation — Changelog and re - Regular expres

The split() function of Python's built-in module has changed in a puzzling way - is this a bug?

2021-04-22 Thread Andy AO
Upgrading from Python 3.6.8 to Python 3.9.0 and executing unit tests revealed a significant change in the behavior of re.split(). but looking at the relevant documentation — Changelog and re - Regular expression operations - Python 3.9.4 documen

Re: csv into multiple columns using split function using python

2016-11-30 Thread Peter Otten
handa...@gmail.com wrote: > I am trying to split a specific column of csv into multiple column and > then appending the split values at the end of each row. > > `enter code here` > > import csv > fOpen1=open('Meta_D1.txt') > > reader=csv.reader(fO

Re: csv into multiple columns using split function using python

2016-11-29 Thread woooee
Add some print statements to see what is happening, especially after the for elem in mylist1: statement -- https://mail.python.org/mailman/listinfo/python-list

csv into multiple columns using split function using python

2016-11-29 Thread handar94
I am trying to split a specific column of csv into multiple column and then appending the split values at the end of each row. `enter code here` import csv fOpen1=open('Meta_D1.txt') reader=csv.reader(fOpen1) mylist=[elem[1].split(',') for elem in

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

Split function for host:port in standard lib

2008-08-26 Thread Michael Ströder
HI! 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? Ciao, Michael. -- http://mail.python.org/mailman/listinfo/python-list

Re: multi split function taking delimiter list

2006-11-16 Thread Paul McGuire
On Nov 14, 5:41 pm, "Sam Pointon" <[EMAIL PROTECTED]> wrote: > On Nov 14, 7:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > Hi, I'm looking for something like: > > > multi_split( 'a:=b+c' , [':=','+'] ) > > > returning: > > ['a', ':=', 'b', '+', 'c'] > > > whats the python way to achi

Re: multi split function taking delimiter list

2006-11-16 Thread Frederic Rentsch
Paddy wrote: > Paddy wrote: > >> Paddy wrote: >> >>> [EMAIL PROTECTED] wrote: >>> Hi, I'm looking for something like: multi_split( 'a:=b+c' , [':=','+'] ) returning: ['a', ':=', 'b', '+', 'c'] whats the python way to achieve this, preferably without regexp? >

Re: multi split function taking delimiter list

2006-11-15 Thread Paddy
Paddy wrote: > Paddy wrote: > > > [EMAIL PROTECTED] wrote: > > > > > Hi, I'm looking for something like: > > > > > > multi_split( 'a:=b+c' , [':=','+'] ) > > > > > > returning: > > > ['a', ':=', 'b', '+', 'c'] > > > > > > whats the python way to achieve this, preferably without regexp? > > > > >

Re: multi split function taking delimiter list

2006-11-14 Thread Paddy
Paddy wrote: > [EMAIL PROTECTED] wrote: > > > Hi, I'm looking for something like: > > > > multi_split( 'a:=b+c' , [':=','+'] ) > > > > returning: > > ['a', ':=', 'b', '+', 'c'] > > > > whats the python way to achieve this, preferably without regexp? > > > > Thanks. > > > > Martin > > I resisted m

Re: multi split function taking delimiter list

2006-11-14 Thread Sam Pointon
On Nov 14, 7:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, I'm looking for something like: > > multi_split( 'a:=b+c' , [':=','+'] ) > > returning: > ['a', ':=', 'b', '+', 'c'] > > whats the python way to achieve this, preferably without regexp? pyparsing

Re: multi split function taking delimiter list

2006-11-14 Thread Paddy
[EMAIL PROTECTED] wrote: > Hi, I'm looking for something like: > > multi_split( 'a:=b+c' , [':=','+'] ) > > returning: > ['a', ':=', 'b', '+', 'c'] > > whats the python way to achieve this, preferably without regexp? > > Thanks. > > Martin I resisted my urge to use a regexp and came up with this:

Re: multi split function taking delimiter list

2006-11-14 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hi, I'm looking for something like: > > multi_split( 'a:=b+c' , [':=','+'] ) > > returning: > ['a', ':=', 'b', '+', 'c'] > > whats the python way to achieve this, preferably without regexp? What do you have against regexp? re.split() does exactly what you want: In [1

Re: multi split function taking delimiter list

2006-11-14 Thread Peter Otten
[EMAIL PROTECTED] wrote: > Hi, I'm looking for something like: > > multi_split( 'a:=b+c' , [':=','+'] ) > > returning: > ['a', ':=', 'b', '+', 'c'] > > whats the python way to achieve this, preferably without regexp? I think in this case the regexp approach is the simplest, though: >>> def mu

Re: multi split function taking delimiter list

2006-11-14 Thread Raymond Hettinger
[EMAIL PROTECTED] wrote: > Hi, I'm looking for something like: > > multi_split( 'a:=b+c' , [':=','+'] ) > > returning: > ['a', ':=', 'b', '+', 'c'] > > whats the python way to achieve this, preferably without regexp? I think regexps are likely the right way to do this kind of tokenization. The s

multi split function taking delimiter list

2006-11-14 Thread [EMAIL PROTECTED]
Hi, I'm looking for something like: multi_split( 'a:=b+c' , [':=','+'] ) returning: ['a', ':=', 'b', '+', 'c'] whats the python way to achieve this, preferably without regexp? Thanks. Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: using split function

2006-11-07 Thread [EMAIL PROTECTED]
Thanks a lot, I am done with that part. But now I am facing another problem. I am using the code given below where A is a matrix and row is a sequence. But it gives following error: error-- A[a,:]=row ValueError: setting an array element with a sequence. --code---

Re: using split function

2006-11-06 Thread Gabriel Genellina
> I have to write a code in python to read a matrix from a text file and > for that i am using following code. But it gives an error saying > "NameError: name 'split' is not defined". Can anyone help me with this. A few hints: - don't use "file" as a name - it shadows the builtin "file" type -

Re: using split function

2006-11-06 Thread ina
[EMAIL PROTECTED] wrote: > Hi, > > I have to write a code in python to read a matrix from a text file and > for that i am using following code. But it gives an error saying > "NameError: name 'split' is not defined". Can anyone help me with this. > -

using split function

2006-11-06 Thread [EMAIL PROTECTED]
Hi, I have to write a code in python to read a matrix from a text file and for that i am using following code. But it gives an error saying "NameError: name 'split' is not defined". Can anyone help me with this. - #!/usr/bin/python import numpy file

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

split function

2005-08-22 Thread Mohammed Altaj
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 start searching number by number ,first i hav

split function

2005-08-22 Thread Mohammed Altaj
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 on 1 2 4 2 3 3 4 I managed to do what i need , but i

Re: split function

2005-08-22 Thread Peter Hansen
rying to perform, or something. "Deal with" could mean anything, so it means nothing. > looks like > 1 3 > 3 4 > 5 2 > 6 1 > > I tried to with my data as it, but i couldn't , so i removed the spaces > 13 > 34 > 52 > 61 > > But when i d

split function

2005-08-22 Thread Mohammed Altaj
umber > 9 , i tried to use split function , but doesn't work , I can attach my code if its good idea to do ,, Thanks -- http://mail.python.org/mailman/listinfo/python-list