Reputation: 21961
e = '[{lat:-34.92967677667683,lng:-62.34831333160395},{lat:-34.93002861969753,lng:-62.360866069793644},{lat:-34.93526211379422,lng:-62.36063016609785},{lat:-34.93571078689853,lng:-62.35996507775451},{lat:-34.935798629937075,lng:-62.34816312789911},{lat:-34.9333358703344,lng:-62.34824895858759},{lat:-34.9320340961022,lng:-62.348334789276066}]'
I want to replace lat
with "lat"
and lng
with "lng"
.
However, this does not work:
e.replace('lat', "lat")
Upvotes: 1
Views: 54
Reputation: 189
e.replace("lat","\"lat\"")
You can use \
for escaping special chars like "
'
Upvotes: 1
Reputation: 1169
e=e.replace("lat","\"lat\"")
For replacing with an escape sequence. ,you always have to put an \
backslash before it
Upvotes: 0