Replace string with method argument

region_name = ‘test region’
region_checked= ‘ReplaceText’
resp = region_checked.replace(‘ReplaceText’,‘Region : region_name’)
print(resp)

Output I want to see is ‘Region : test region’

How can I get this output.

As you have written this line, region_name is part of the string you are outputting. You want the content concatenated to the first part of the string:

>>> region_name = 'test region'
>>> region_checked= 'ReplaceText'
>>> region_checked.replace('ReplaceText','Region : '+ region_name)
'Region : test region'

If it is just about the text output, there are more ways to do what you, e.g. through string formatting:

>>> 'Region : {}'.format(region_name)
'Region : test region'

See string — Common string operations — Python 3.9.6 documentation and the formatted string literals.

Thank you for your reply sir.

Great buddy. I am about to answer but stop my self.