On 16 Okt., 02:18, Mensanator mensana...@aol.com wrote:
All I wanted to do is split a binary number into two lists,
a list of blocks of consecutive ones and another list of
blocks of consecutive zeroes.
Back to the OP's problem, the obvious (if you know the std lib) and
easy solution is:
c =
2009/10/26 jhermann juergen.herm...@1und1.de:
On 16 Okt., 02:18, Mensanator mensana...@aol.com wrote:
All I wanted to do is split a binary number into two lists,
a list of blocks of consecutive ones and another list of
blocks of consecutive zeroes.
Back to the OP's problem, the obvious (if
On Oct 26, 7:28 am, Vlastimil Brom vlastimil.b...@gmail.com wrote:
2009/10/26 jhermann juergen.herm...@1und1.de:
On 16 Okt., 02:18, Mensanator mensana...@aol.com wrote:
All I wanted to do is split a binary number into two lists,
a list of blocks of consecutive ones and another list of
Mensanator mensana...@aol.com writes:
No one ever considers making life easy for the user.
That's a bizarre assertion.
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 22, 1:22 pm, Paul Rudin paul.nos...@rudin.co.uk wrote:
Mensanator mensana...@aol.com writes:
No one ever considers making life easy for the user.
That's a bizarre assertion.
I have a bad habit of doing that.
--
http://mail.python.org/mailman/listinfo/python-list
On Oct 22, 2:23 pm, Falcolas garri...@gmail.com wrote:
On Oct 22, 11:56 am, Mensanator mensana...@aol.com wrote:
[massive snip]
Yes, AFTER you read the docs.
Not to feed the troll,
I prefer the term gadfly.
but obligatory reference to XKCD:
http://xkcd.com/293/
--
On 10/21/2009 11:47 PM, Carl Banks wrote:
On Oct 21, 12:46 pm, David C Ullrich dullr...@sprynet.com wrote:
On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote:
On Oct 20, 1:51 pm, David C Ullrich dullr...@sprynet.com wrote:
I'm not saying either behaviour is wrong, it's just not obvious
On Oct 21, 11:21�pm, John Yeung gallium.arsen...@gmail.com wrote:
On Oct 21, 5:43�pm, Mensanator mensana...@aol.com wrote:
'01110'.split('0')
['', '1', '', '', '', '11', '']
is a perfect example. It shows the empty strings
generated from the leading and trailing delimiters,
and
On Oct 22, 1:13�am, ru...@yahoo.com wrote:
On 10/21/2009 11:47 PM, Carl Banks wrote:
On Oct 21, 12:46 pm, David C Ullrich dullr...@sprynet.com wrote:
On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote:
On Oct 20, 1:51 pm, David C Ullrich dullr...@sprynet.com wrote:
I'm not saying
On Wed, 21 Oct 2009 22:47:24 -0700 (PDT), Carl Banks
pavlovevide...@gmail.com wrote:
On Oct 21, 12:46 pm, David C Ullrich dullr...@sprynet.com wrote:
On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote:
On Oct 20, 1:51 pm, David C Ullrich dullr...@sprynet.com wrote:
I'm not saying either
On Wed, 21 Oct 2009 14:43:48 -0700 (PDT), Mensanator
mensana...@aol.com wrote:
On Oct 21, 2:46 pm, David C Ullrich dullr...@sprynet.com wrote:
On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote:
On Oct 20, 1:51 pm, David C Ullrich dullr...@sprynet.com wrote:
On Thu, 15 Oct 2009 18:18:09
On Oct 22, 7:47�am, David C. Ullrich dullr...@sprynet.com wrote:
On Wed, 21 Oct 2009 14:43:48 -0700 (PDT), Mensanator
mensana...@aol.com wrote:
On Oct 21, 2:46�pm, David C Ullrich dullr...@sprynet.com wrote:
On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote:
On Oct 20, 1:51�pm,
On Wed, 21 Oct 2009 14:43:48 -0700 (PDT), Mensanator
mensana...@aol.com wrote:
On Oct 21, 2:46 pm, David C Ullrich dullr...@sprynet.com wrote:
On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote:
On Oct 20, 1:51 pm, David C Ullrich dullr...@sprynet.com wrote:
On Thu, 15 Oct 2009 18:18:09
Carl Banks wrote:
snip
s.split() and s.split(sep) do different things, and there is no string
sep that can make s.split(sep) behave like s.split(). That's not
unheard of but it does go against our typical expectations. It would
have been a better library design if s.split() and s.split(sep)
On Oct 22, 8:17 am, David C. Ullrich dullr...@sprynet.com wrote:
On Wed, 21 Oct 2009 14:43:48 -0700 (PDT), Mensanator
mensana...@aol.com wrote:
On Oct 21, 2:46 pm, David C Ullrich dullr...@sprynet.com wrote:
On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote:
On Oct 20, 1:51 pm,
On Oct 22, 10:05 am, John Posner jjpos...@optimum.net wrote:
Carl Banks wrote:
snip
s.split() and s.split(sep) do different things, and there is no string
sep that can make s.split(sep) behave like s.split(). That's not
unheard of but it does go against our typical expectations. It
On 10/22/2009 07:17 AM, David C. Ullrich wrote:
On Wed, 21 Oct 2009 14:43:48 -0700 (PDT), Mensanator
mensana...@aol.com wrote:
On Oct 21, 2:46 pm, David C Ullrich dullr...@sprynet.com wrote:
On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote:
On Oct 20, 1:51 pm, David C Ullrich
[resend, with Subject line corrected and formatting crud deleted]
Mensanator wrote:
That's interesting. If string.splitfields(delim) was equivalent to
str.split(sep), it would have been useful to add the phrase
str.split(sep) is equivalent to the old string.splitfields(delim)
which no longer
On Oct 22, 4:35 pm, John Posner jjpos...@optimum.net wrote:
[resend, with Subject line corrected and formatting crud deleted]
Mensanator wrote:
That's interesting. If string.splitfields(delim) was equivalent to
str.split(sep), it would have been useful to add the phrase
str.split(sep) is
En Thu, 22 Oct 2009 19:45:54 -0300, Mensanator mensana...@aol.com
escribió:
On Oct 22, 4:35 pm, John Posner jjpos...@optimum.net wrote:
Mensanator wrote:
That's interesting. If string.splitfields(delim) was equivalent to
str.split(sep), it would have been useful to add the phrase
On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote:
On Oct 20, 1:51 pm, David C Ullrich dullr...@sprynet.com wrote:
On Thu, 15 Oct 2009 18:18:09 -0700, Mensanator wrote:
All I wanted to do is split a binary number into two lists, a list of
blocks of consecutive ones and another list of
On Oct 21, 2:46 pm, David C Ullrich dullr...@sprynet.com wrote:
On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote:
On Oct 20, 1:51 pm, David C Ullrich dullr...@sprynet.com wrote:
On Thu, 15 Oct 2009 18:18:09 -0700, Mensanator wrote:
All I wanted to do is split a binary number into two
On Oct 21, 12:46 pm, David C Ullrich dullr...@sprynet.com wrote:
On Tue, 20 Oct 2009 15:22:55 -0700, Mensanator wrote:
On Oct 20, 1:51 pm, David C Ullrich dullr...@sprynet.com wrote:
I'm not saying either behaviour is wrong, it's just not obvious that the
one behaviour doesn't follow from
On Thu, 15 Oct 2009 18:18:09 -0700, Mensanator wrote:
All I wanted to do is split a binary number into two lists, a list of
blocks of consecutive ones and another list of blocks of consecutive
zeroes.
But no, you can't do that.
c = '001110'
c.split('0')
['', '', '1', '', '', '',
On Oct 20, 1:51 pm, David C Ullrich dullr...@sprynet.com wrote:
On Thu, 15 Oct 2009 18:18:09 -0700, Mensanator wrote:
All I wanted to do is split a binary number into two lists, a list of
blocks of consecutive ones and another list of blocks of consecutive
zeroes.
But no, you can't do
On Oct 16, 11:41�pm, Paul Rubin http://phr...@nospam.invalid wrote:
Mensanator mensana...@aol.com writes:
Thanks, but what I wanted was
['00','1','0','1','0','','00','1','0' '1'].
� � c = '00101000101'
� � list(''.join(g) for k,g in groupby(c))
� � ['00', '1', '0', '1', '0',
On Oct 16, 10:30�am, John Posner jjpos...@optimum.net wrote:
Mensenator said:
c = '001110'
c.split('0')
['', '', '1', '', '', '', '11', '']
Ok, the consecutive delimiters appear as empty strings for
reasons unknown (except for the first one). Except when they
start or end the
On Oct 15, 9:18 pm, Mensanator mensana...@aol.com wrote:
All I wanted to do is split a binary number into two lists,
a list of blocks of consecutive ones and another list of
blocks of consecutive zeroes.
But no, you can't do that.
c = '001110'
c.split('0')
['', '', '1', '', '', '',
On Oct 15, 6:57 pm, Ishwor Gurung ishwor.gur...@gmail.com wrote:
Too bad groupby is only available in Python2.6+
Since you're here, any chance of getting your NDK team to look into
getting some small subset of STL, Boost into Android?
Aren't Java collections bad enough? :)
Carl Banks
--
On Oct 16, 8:00�pm, Thomas thom1...@gmail.com wrote:
On Oct 15, 9:18�pm, Mensanator mensana...@aol.com wrote:
All I wanted to do is split a binary number into two lists,
a list of blocks of consecutive ones and another list of
blocks of consecutive zeroes.
But no, you can't do that.
Mensanator mensana...@aol.com writes:
Thanks, but what I wanted was
['00','1','0','1','0','','00','1','0' '1'].
c = '00101000101'
list(''.join(g) for k,g in groupby(c))
['00', '1', '0', '1', '0', '', '00', '1', '0', '1']
is really not that unnatural.
--
All I wanted to do is split a binary number into two lists,
a list of blocks of consecutive ones and another list of
blocks of consecutive zeroes.
But no, you can't do that.
c = '001110'
c.split('0')
['', '', '1', '', '', '', '11', '']
Ok, the consecutive delimiters appear as empty
Hi
2009/10/16 Mensanator mensana...@aol.com:
All I wanted to do is split a binary number into two lists,
a list of blocks of consecutive ones and another list of
blocks of consecutive zeroes.
Just briefly looked at your problem. Try this:
Mensanator wrote:
All I wanted to do is split a binary number into two lists,
a list of blocks of consecutive ones and another list of
blocks of consecutive zeroes.
But no, you can't do that.
c = '001110'
c.split('0')
['', '', '1', '', '', '', '11', '']
[ ... ]
OTOH, if my digits
On Fri, 16 Oct 2009, Mensanator wrote:
All I wanted to do is split a binary number into two lists,
a list of blocks of consecutive ones and another list of
blocks of consecutive zeroes.
[...]
That means I can use re to solve my problem after all.
c = '001110'
re.sub('0','
Mensanator mensana...@aol.com writes:
And the re module doesn't help.
f = ' 1 2 3 4'
re.split(' ',f)
['', '', '1', '2', '', '3', '', '', '4', '', '', '', '']
filter(bool, re.split(' ', f))
You might also like:
from itertools import groupby
c = '001110'
print
2009/10/16 Paul Rubin http://phr...@nospam.invalid:
[...]
You might also like:
from itertools import groupby
c = '001110'
print list(list(xs) for k,xs in groupby(c))
Too bad groupby is only available in Python2.6+
Since you're here, any chance of getting your NDK team to look
2009/10/16 Ishwor Gurung ishwor.gur...@gmail.com:
2009/10/16 Paul Rubin http://phr...@nospam.invalid:
[...]
You might also like:
from itertools import groupby
c = '001110'
print list(list(xs) for k,xs in groupby(c))
Too bad groupby is only available in Python2.6+
OK. I stand
Ishwor Gurung ishwor.gur...@gmail.com writes:
Since you're here, any chance of getting your NDK team to look into
getting some small subset of STL, Boost into Android? :-P That'd be
awesome thing you know.
My what who where? You are confusing me with someone else.
--
I think I am getting old :-( Should have Googled already.
My what who where? You are confusing me with someone else.
Andy Rubin- http://en.wikipedia.org/wiki/Andy_Rubin
Sorry to bother you.
--
Regards,
Ishwor Gurung
--
http://mail.python.org/mailman/listinfo/python-list
40 matches
Mail list logo