Python replace, I have a question!

Asked 2 weeks ago, Updated 2 weeks ago, 3 views

b=2

A= "Oh, I really want to eat 'crunchy' \"jeon\"."

B=A[5:9]

C=B.replace(B), 'Brown'

C=C.replace(B),'Yellow',b)

print(C)

When you print out a C, 'Yellow' 'Yellow' Shouldn't it come out as? I'm asking because I don't know what's wrong.

python function string replace

2022-09-20 15:03

1 Answers

The replace command replaces a string that matches the condition, not a command that adds a string.


2022-09-20 15:03

If you have any answers or tips


© 2022 pinfo. All rights reserved.