Writing to JSON - Converting \u00a3 to £
If you're using json.dump()
or json.dumps()
, try setting ensure_ascii=False
you can encode the string like below
s = 'This is a Pound sign \u00a3's.encode('utf8')print(s)
Output
This is a Pound sign £
You need to call text("utf-8")
while printing as follows:
print(page.find_element_by_class_name('header_tags').text("utf-8"))
But this issue can occur at some lines as well. So as per best practices start the Python file with the line:
# -*- coding: UTF-8 -*-
An example:
from selenium import webdriver# other lines of codeprice = page.find_element_by_class_name('header_tags').text