On Mon, 23 Jan 2017 13:23:38 -0800 (PST), subhabangal...@gmail.com wrote:
> I have a string like
>
> "Trump is $ the president of USA % Obama was $ the president
> of USA % Putin is $ the premier of Russia%"
>
> Here, I want to extract the portions from $...%, which would be
>
> "the president of
On Tue, Jan 24, 2017 at 8:23 AM, wrote:
> I have a string like
>
> "Trump is $ the president of USA % Obama was $ the president of USA % Putin
> is $ the premier of Russia%"
>
> Here, I want to extract the portions from $...%, which would be
>
> "the president of USA",
> "the president of USA",
I have a string like
"Trump is $ the president of USA % Obama was $ the president of USA % Putin is
$ the premier of Russia%"
Here, I want to extract the portions from $...%, which would be
"the president of USA",
"the president of USA",
"the premier of Russia"
and would work some post extr
On 9/28/2011 5:28 AM, Xah Lee wrote:
curious question.
suppose you have 300 different strings and they need all be replaced
to say "aaa".
is it faster to replace each one sequentially (i.e. replace first
string to aaa, then do the 2nd, 3rd,...)
, or is it faster to use a regex with “or” them al
Willem writes:
> Eli the Bearded wrote:
> ) In comp.lang.perl.misc, Willem wrote:
> )> In Perl, it would be applicable. You see, in Perl, you can call a function
> )> in the replacement of the regex substitution, which can then look up the
> )> html entity and return the wanted unicode literal
Eli the Bearded wrote:
) In comp.lang.perl.misc, Willem wrote:
)> In Perl, it would be applicable. You see, in Perl, you can call a function
)> in the replacement of the regex substitution, which can then look up the
)> html entity and return the wanted unicode literal.
)
) A function? I'd use a
In comp.lang.perl.misc, Willem wrote:
> In Perl, it would be applicable. You see, in Perl, you can call a function
> in the replacement of the regex substitution, which can then look up the
> html entity and return the wanted unicode literal.
A function? I'd use a hash.
> I think you can do th
On Wed, Sep 28, 2011 at 3:28 AM, Xah Lee wrote:
> curious question.
>
> suppose you have 300 different strings and they need all be replaced
> to say "aaa".
>
> is it faster to replace each one sequentially (i.e. replace first
> string to aaa, then do the 2nd, 3rd,...)
> , or is it faster to use a
On 28/09/2011 18:00, Willem wrote:
Xah Lee wrote:
) the question originally came from when i was coding elisp of a
) function that changes html entities to unicode char literal. The
) problem is slightly complicated, involving a few questions about speed
) in emacs. e.g. string vs buffer, and muc
Xah Lee wrote:
) the question originally came from when i was coding elisp of a
) function that changes html entities to unicode char literal. The
) problem is slightly complicated, involving a few questions about speed
) in emacs. e.g. string vs buffer, and much more... i spent several
) hours on
On Wed, Sep 28, 2011 at 11:22 PM, Neil Cerutti wrote:
> I'd like to know what "string replacement" is supposed to mean in
> the context of Python.
>
Substring replacement, such as:
>>> "Hello, world!".replace(", "," -- ")
'H
gt; > And you'll find that this is, by and large, the most normal
> > situation. Folding many strings down to one string is a lot
> > less common. So, let's have some real-world use cases and then
> > we can talk recommendations.
>
> I'd like to know what &q
rings down to one string is a lot
> less common. So, let's have some real-world use cases and then
> we can talk recommendations.
I'd like to know what "string replacement" is supposed to mean in
the context of Python.
--
Neil Cerutti
"A politician is an arse
On Wed, Sep 28, 2011 at 11:14 PM, Xah Lee wrote:
> (while (< ii (length pairs))
> (setq mystr (replace-regexp-in-string
> (elt tempMapPoints ii)
> (elt (elt pairs ii) 1)
> mystr t t))
> (setq ii (1+ ii))
> )
from __future__ impo
here's more detail about the origin of this problem. Relevant to emacs
lisp only.
--
in the definition of “replace-regexp-in-string”, there's this comment:
;; To avoid excessive consing from multiple matches in long strings,
;; don't just call `replace-match' cont
On Wed, Sep 28, 2011 at 10:28 PM, Xah Lee wrote:
> each string needs to be changed to a unique
> string, not all to the same string.
And you'll find that this is, by and large, the most normal situation.
Folding many strings down to one string is a lot less common. So,
let's have some real-world
On Sep 28, 3:57 am, mer...@stonehenge.com (Randal L. Schwartz) wrote:
> > "Xah" == Xah Lee writes:
>
> Xah> curious question.
> Xah> suppose you have 300 different strings and they need all be replaced
> Xah> to say "aaa".
>
> And then suppose this isn't the *real* question, but one entirely o
> "Xah" == Xah Lee writes:
Xah> curious question.
Xah> suppose you have 300 different strings and they need all be replaced
Xah> to say "aaa".
And then suppose this isn't the *real* question, but one entirely of
Fiction by Xah Lee.
How helpful do you want to be?
--
Randal L. Schwartz - St
On Wed, Sep 28, 2011 at 7:28 PM, Xah Lee wrote:
> suppose you have 300 different strings and they need all be replaced
> to say "aaa".
>
> is it faster to replace each one sequentially
Before you ask "is it faster", you need to first be sure it's correct.
I would recommend doing all the replaces
curious question.
suppose you have 300 different strings and they need all be replaced
to say "aaa".
is it faster to replace each one sequentially (i.e. replace first
string to aaa, then do the 2nd, 3rd,...)
, or is it faster to use a regex with “or” them all and do replace one
shot? (i.e. "1stst
Ulrich Eckhardt wrote:
> What I'm surprised is that this isn't supported:
>
> "%(1)s %(2)s" % ("zero", "one", "two")
Thanks Terry and Matimus, actually I'm using 2.4 and considering upgrading
now. ;)
Uli
--
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
-
On Jun 24, 12:26 pm, Terry Reedy <[EMAIL PROTECTED]> wrote:
> Ulrich Eckhardt wrote:
> > What I'm surprised is that this isn't supported:
>
> > "%(1)s %(2)s" % ("zero", "one", "two")
>
> > i.e. specifying the index in a sequence instead of the key into a map (maybe
> > I would use [1] instead of
Ulrich Eckhardt wrote:
What I'm surprised is that this isn't supported:
"%(1)s %(2)s" % ("zero", "one", "two")
i.e. specifying the index in a sequence instead of the key into a map (maybe
I would use [1] instead of (1) though). Further, the key can't be a simple
number it seems, which make
Hi!
I'm still mostly learning Python and there is one thing that puzzles me
about string formatting. Typical string formatting has these syntaxes:
"%s is %s" % ("GNU", "not Unix")
"%(1)s %(2)s" % ("1":"one", "2":"two")
What I'm surprised is that this isn't supported:
"%(1)s %(2)s" % ("zer
HI,
Thanks for the reply.that seems to work,but i was doing this
so as to attach it to a bigger code where it will be utilised before
a
parsing.
#Input file and Output file path from user
file_input = raw_input("Enter The ODX File Path:")
(shortname,ext)=os.path.splitext(file_input)
f
25 matches
Mail list logo