string replace shortcut

vedrandekovic at v-programs.com vedrandekovic at v-programs.com
Tue Sep 18 07:44:32 EDT 2007


Hello,

I am trying to replace some string with list objects:

>>> my_text1="function1 function2"
>>> from my_module_with_functions_1 import *
>>> from my_module_with_functions_2 import *

# functions in module " my_module_with_functions_1 ":
 
my_func1  it's value "function1"
 
my_func2  it's value "function2"

# functions in module " my_module_with_functions_2 ":
 
my_func100  it's value "bla bla 1"
 
my_func200  it's value "bla bla 2"

........now, we need find and replace functions from module "
my_module_with_functions_1 "  and
replace them with  functions from module " my_module_with_functions_2
"

with: my_text1.replace(items1,items2)

Result must be:

>>> print my_text1.replace(items1,items2)
bla bla 1 bla bla 2


Regards,
Vedran




More information about the Python-list mailing list