Basically in my student data I am having an issue where by I am getting weird sumbols in my data as you can see: MAIN £1.00
when it should show MAIN £1.00
Below is a snippet of my code what scrapes a website for certain student information for their student discounts and eventually writes it to file.
# -*- coding: utf-8 -*-
totals = main.find_all('p')
for total in totals:
if total .find(text=re.compile("Main:")):
total = total.get_text()
if u"Main £" in total:
pull1 = re.search(r'(MAIN) (\D\w+\D\d+)', total)
pull2 = re.search(r'(MAINER) (\D\w+\D\d+)', total)
if pull1:
rpr_data.append(pull1.group(0).title())
print pull1.group(0).title()
if pull2:
rpr_data.append(pull2.group(0).title())
print pull2.group(0).title()
with open('RPR.txt','w') as rpr_file:
rpr_file.write('\n'.join(rpr_data).encode("UTF-8"))
When I try and re-use this data in the script Matching three variables from textfile to csv and writing variables to the csv on matched rows even though the data in the text file has no weird Â
symbol when it writes to CSV the symbol comes back...
How can I permanently eradicate this Â
symbol correctly?