tags:

views:

44

answers:

2

In my utf-8 encoded file, there are curly quotes (“”).

How do I replace them all with normal quotes (")?

cell_info.replace('“','"')
cell_info.replace('”','"')

did not work. No error message.

Thank you. :)

+3  A: 

str.replace() doesn't replace the original string, it just returns a new one.

Do:

cell_info = cell_info.replace('“','"').replace('”','"')
NullUserException
Yikes. I can't believe I didn't see that. Thanks! :)
Eric
+2  A: 
cell_info = cell_info.replace('“','"').replace('”','"')

The replace method return a new string with the replacement done. It doesn't act directly on the string.

Etienne