How to replace characters in a string?

Chris Angelico rosuav at gmail.com
Wed Jun 8 04:22:33 EDT 2022


On Wed, 8 Jun 2022 at 18:20, Dave <dave at looktowindward.com> wrote:
>
> PS
>
> I’ve also tried:
> myCompareFile1 = myTitleName
> myCompareFile1.replace("\u2019", "'")
> myCompareFile2 = myCompareFileName
> myCompareFile2.replace("\u2019", "'")
> Which also doesn’t work, the replace itself work but it still fails the compare?
>

This is a great time to start exploring what actually happens when you
do "myCompareFile2 = myCompareFileName". I recommend doing some poking
around with strings (which are immutable), lists (which aren't), and
tuples (which aren't, but can contain mutable children).

ChrisA


More information about the Python-list mailing list