Hi Karthik,
On Jan 7, 2008 1:51 PM, p karthik <karthik1212@...> wrote:
> I am Karthik. I use jython 2.1 for WLST ( Weblogic Scripting Tool) to
> configure my weblogic domain.
> I am in need of a string substitution method. I have seen we can do this by
> using Template, substitute or safe_substitute methods in Python.
> But I don't see this in Jython.
>
> Do we have any String substitution methods in Jython like the one above in
> Python?
Template didn't appear in CPython until 2.4, so it isn't available in
Jython 2.1 or even in the more recent 2.2. I'm not sure how extensive
your string substitution needs are, but basic string formatting in
Python handles replacing values from a dict:
>>> '%(language)s supports substitutions from %(holder)s-like objects'
% {'language':'Jython', 'holder':'dict'}
'Jython supports substitutions from dict-like objects'
See http://docs.python.org/lib/typesseq-strings.html for more details.
Also, this is the jython-dev mailing list, which is for the discussion
of the development of Jython. Questions like this about using Jython
should be sent to the jython-users list.
Thanks,
Charlie
|