Python 3.8.12 replace function does not work.

Asked 1 weeks ago, Updated 1 weeks ago, 1 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


© 2022 pinfo. All rights reserved.