Forum Archive

Inverted Commas in Strings

TomD

I have a data file that I sent to UTF8 which puts the inverted comma character in its output.
How do I detect and remove the “ character from a string? Trying to define is as “”” i.e. 3 “ in a row, is overidden by the editor to become 4 “ in a row. It will not treat the “ character as a character.

cvp

@TomD Try (or I didn't understand)

a = 'hello “friend“'
print(a)
print(a.replace('“',''))
TomD

@CVP, you do seem to understand but it doesn’t change the output. Syntax is good but the printed line is still:

Hello “Friend”

cvp

@TomD my print output:

hello “friend“
hello friend
TomD

Works now. I must have had a transcription error. Thankyou