[Zope] Using the replace function in a Zope Python Script

Andy Gimblett andy.gimblett@ftech.net
Thu, 16 Aug 2001 17:21:59 +0100


> Have you tried:
> import string
> 
> return string.replace("flubbery", "flub", "shrub")

Alternatively you can use the under namespace:

return _.string.replace("flubbery", "flub", "shrub")

although you'll first need to go to the python script object's
"Bindings" tab and bind _ as the namespace (which is the
recommended value anyway).

I'm not sure if/why this is better than the way mentioned above,
mind. :-)

-Andy

-- 
Andy Gimblett - Programmer - Frontier Internet Services Limited
Tel: 029 20 820 044 Fax: 029 20 820 035 http://www.frontier.net.uk/
Statements made are at all times subject to Frontier's Terms and
Conditions of Business, which are available upon request.