Fredrik Lundh:
> or you could use re.finditer, which can be used for a lot more than just
> splitting.
Having implemented some of them (and even invented algorithms like a
new substring search, that I have appreciated) you know that string
methods are simpler ways to efficiently perform specialize
On Aug 17, 3:12 pm, Alexnb <[EMAIL PROTECTED]> wrote:
> Uhm, "string" and "non-string" are just that, words within the string. Here
> shall I dumb it down for you?
>
> string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes
> text6 no text7 yes text8"
>
> It doesn't matter what is
Alexnb wrote:
Uhm, "string" and "non-string" are just that, words within the string. Here
shall I dumb it down for you?
string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes
text6 no text7 yes text8"
It doesn't matter what is in the string, I want to be able to know exactly
Wojtek Walczak wrote:
Got no idea, but it might be a nice try. It should be a quite good memory
saver for very large strings.
or you could use re.finditer, which can be used for a lot more than just
splitting.
--
http://mail.python.org/mailman/listinfo/python-list
Mensanator wrote:
On Aug 17, 6:03�pm, B <[EMAIL PROTECTED]> wrote:
Alexnb wrote:
Uhm, "string" and "non-string" are just that, words within the string. Here
shall I dumb it down for you?
string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes
text6 �no text7 yes text8"
It doesn
On Aug 17, 6:03�pm, B <[EMAIL PROTECTED]> wrote:
> Alexnb wrote:
> > Uhm, "string" and "non-string" are just that, words within the string. Here
> > shall I dumb it down for you?
>
> > string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes
> > text6 �no text7 yes text8"
>
> > It d
On Sun, 17 Aug 2008 12:07:45 -0700 (PDT), [EMAIL PROTECTED] wrote:
> I'm waiting for a str.xsplit still :-)
> If I write and submit a C implementation of xsplit how many chances do
> I have to see it included into Python? :-)
Got no idea, but it might be a nice try. It should be a quite good memo
Alexnb wrote:
Uhm, "string" and "non-string" are just that, words within the string. Here
shall I dumb it down for you?
string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes
text6 no text7 yes text8"
It doesn't matter what is in the string, I want to be able to know exactl
MRAB:
> If it was introduced into Python v3.x then wouldn't it have to be
> called str.split in order to be consistent with xrange -> range? :-)
xsplit may be a name fit for Python 2.6/2.7.
Regarding Python 3.0 you may be right, but then when you want the list
of parts you have to do:
list(somest
On Aug 17, 8:40 pm, [EMAIL PROTECTED] wrote:
> Eric Wertman:
>
> > So what exactly does that do? Returns a generator, instead of a list?
>
> Allows you to iterate on the parts in a lazy way, without creating the
> whole list of the pieces.
> The arguments are the same of str.split().
>
If it was i
Ok, after sending my post, I see, that the code got a bit screewed up, but
morover, there should probably be a word boundary in the closing part of the
regexp. A next attempt + added stripping the "yes" delimiter and the
whitespace...:
>>> import re
>>> input_text = """yes text1 yes text2 yes text
Am Sun, 17 Aug 2008 13:12:36 -0700 schrieb Alexnb:
> Uhm, "string" and "non-string" are just that, words within the string.
> Here shall I dumb it down for you?
>
Please, bear with us. You are deep into the problem, we are not.
It doesn't help to be rude. If you can explain your problem well, you
2008/8/17 Alexnb <[EMAIL PROTECTED]>
>
> Uhm, "string" and "non-string" are just that, words within the string. Here
> shall I dumb it down for you?
>
>
> string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes
> text6 no text7 yes text8"
>
> It doesn't matter what is in the stri
Alexnb wrote:
Uhm, "string" and "non-string" are just that, words within the string.
From what I can tell, this is the first time you use the word "word" in
your posts.
> Here shall I dumb it down for you?
No, you should do what you should have done from the very beginning:
explain what y
On 2008-08-17, Alexnb <[EMAIL PROTECTED]> wroted:
> string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes
> text6 no text7 yes text8"
>
> It doesn't matter what is in the string, I want to be able to know exactly
> how many "yes"'s there are.
- cut here -
>>> import r
On 17 Aug, 20:22, Alexnb <[EMAIL PROTECTED]> wrote:
> But I am wondering is there a way to something like this:
>
> funString = "string string string non-string non-string string"
> and
> for "string" in funString:
> print something
>
> I know you can't do that; but, is there a way do do some
Uhm, "string" and "non-string" are just that, words within the string. Here
shall I dumb it down for you?
string = "yes text1 yes text2 yes text3 no text4 yes text5+more Text yes
text6 no text7 yes text8"
It doesn't matter what is in the string, I want to be able to know exactly
how many "yes"
2008/8/17 Alexnb <[EMAIL PROTECTED]>
>
> Basically I want the code to be able to pick out how many strings there are
> and then do something with each, or the number. When I say string I mean
> how
> many "strings" are in the string "string string string non-string string"
>
> Does that help?
>
>
On 2008-08-17, Alexnb <[EMAIL PROTECTED]> wroted:
> Basically I want the code to be able to pick out how many strings
What do you mean by "string"?
foo = "abc abc cde abc ijk abc cde abc"
"foo" is one "string". If you want substrings, specify what kind of substrings
you mean. All occurences
Alexnb wrote:
Basically I want the code to be able to pick out how many strings there are
and then do something with each, or the number. When I say string I mean how
many "strings" are in the string "string string string non-string string"
>
Does that help?
not really, since you haven't def
Eric Wertman:
> So what exactly does that do? Returns a generator, instead of a list?
Allows you to iterate on the parts in a lazy way, without creating the
whole list of the pieces.
The arguments are the same of str.split().
Bye,
bearophile
--
http://mail.python.org/mailman/listinfo/python-list
Basically I want the code to be able to pick out how many strings there are
and then do something with each, or the number. When I say string I mean how
many "strings" are in the string "string string string non-string string"
Does that help?
Fredrik Lundh wrote:
>
> Alexnb wrote:
>
>> Ya jus
Alexnb wrote:
Ya just an example, to print the numbers 1-5
Sorry, I still don't have the slightest idea what you expect the code to do.
But I am wondering is there a way to something like this:
funString = "string string string non-string non-string string"
and
for "string" in funString:
So what exactly does that do? Returns a generator, instead of a list?
> I'm waiting for a str.xsplit still :-)
> If I write and submit a C implementation of xsplit how many chances do
> I have to see it included into Python? :-)
>
> Bye,
> bearophile
> --
> http://mail.python.org/mailman/listinf
Wojtek Walczak:
> >>> somestr = "string1 string2 string3"
> >>> for i in somestr.split():
>
> ...print i
> ...
> string1
> string2
> string3
I'm waiting for a str.xsplit still :-)
If I write and submit a C implementation of xsplit how many chances do
I have to see it included into Python? :-)
On Sun, 17 Aug 2008 11:22:37 -0700 (PDT), Alexnb wrote:
> funString = "string string string non-string non-string string"
> and
> for "string" in funString:
> print something
>
> I know you can't do that; but, is there a way do do something similar that
> gets the same result?
What's "that"
Ya just an example, to print the numbers 1-5
Fredrik Lundh wrote:
>
> Alexnb wrote:
>
>> But I am wondering is there a way to something like this:
>>
>> funString = "string string string non-string non-string string"
>> and
>> for "string" in funString:
>> print something
>>
>> I know
Alexnb wrote:
Okay, so lets say you have a list:
funList = [1,2,3,4,5]
and you do:
for x in funList:
print x
this will print 1-5
But I am wondering is there a way to something like this:
funString = "string string string non-string non-string string"
and
for "string" in funString:
Alexnb wrote:
But I am wondering is there a way to something like this:
funString = "string string string non-string non-string string"
and
for "string" in funString:
print something
I know you can't do that; but, is there a way do do something similar that
gets the same result?
you se
Okay, so lets say you have a list:
funList = [1,2,3,4,5]
and you do:
for x in funList:
print x
this will print 1-5
But I am wondering is there a way to something like this:
funString = "string string string non-string non-string string"
and
for "string" in funString:
print somethi
30 matches
Mail list logo