Python replace, I have a question!

Asked 2 years ago, Updated 2 years ago, 151 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


© 2024 OneMinuteCode. All rights reserved.