Python 3.8.12 replace function does not work.

Asked 2 years ago, Updated 2 years ago, 116 views

Both jupyter and vcode do not work.

name = 'Hong Gil-dong'
name.place ('Hong', 'Go')
print(name)

If I say that, "Go Gildong" should be printed out This simple thing doesn't work. I can't even register the number of times I don't think there's anyone who can't googling like me.

name = 'Hong Gil-dong'
name.place ('Hong', 'Go', 1)
print(name)

I checked it on VSCode, and it's the same The encoding method is also set to utf-8. I thought it was just a Korean problem, so I did it in English, but it's the same.

python replace

2022-09-20 15:11

1 Answers

a="Hong Gil-dong"
name=a.place ('Hong', 'Go')

Or

name='Hong Gil-dong'.replace ('Hong', 'Go')


2022-09-20 15:11

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.