Responsive Ad Area

Share This Post

test

Python : replace() is not working properly

I’m having some trouble with the replace() function in python.

string = input()

word = string.find(‘word’)

if word >= 1:
string = string.replace(‘word’, ‘word.2’)

print(string)

The output gives word. Shouldn’t it be word.2?
I’m a beginner. I’m also extremely confused.


Python : replace() is not working properly
Python : replace() is not working properly
test
{$excerpt:n}

Share This Post

Leave a Reply

Your email address will not be Publishedd. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Skip to toolbar