파이썬에서 £ 값을 고칩니다. 엑셀 시트에 값을 쓰려고하면 프로세스가 중단되고 오류 다음'UnicodeEncodeError :'ascii 'codec'파이썬을 사용하여 엑셀 시트에 £ 기호를 쓰려고 할 때 오류가 발생합니다.
UnicodeEncodeError 'ASCII'코덱 U 위치 0 'xa3 \'문자를 인코딩 할 수없는 (128)
£ 기호 cmd를 프롬프트에 오류없이 인쇄되는 범위에 있지 서수. 어떤 사람들은 제 표 (파운드 기호 유무에 관계없이)에 값 (£ 1,750)을 쓸 수있는 방법을 제안 할 수 있습니까? 많은 감사 ...
import requests
from bs4 import BeautifulSoup as soup
import csv
outputfilename = 'Ed_Streets2.csv'
outputfile = open(outputfilename, 'wb')
writer = csv.writer(outputfile)
writer.writerow([Rateable Value])
url = 'https://www.saa.gov.uk/search/?SEARCHED=1&ST=&SEARCH_TERM=city+of+edinburgh%2C+EDINBURGH&ASSESSOR_ID=&SEARCH_TABLE=valuation_roll_cpsplit&PAGE=0&DISPLAY_COUNT=100&TYPE_FLAG=CP&ORDER_BY=PROPERTY_ADDRESS&H_ORDER_BY=SET+DESC&ORIGINAL_SEARCH_TERM=city+of+edinburgh&DRILL_SEARCH_TERM=BOSWALL+PARKWAY%2C+EDINBURGH&DD_TOWN=EDINBURGH&DD_STREET=BOSWALL+PARKWAY#results'
response = session.get(url)
html = soup(response.text, 'lxml')
prop_link = html.find_all("a", class_="pagelink button small")
for link in prop_link:
prop_url = base_url+(link["href"])
response = session.get(prop_url)
prop = soup(response.content,"lxml")
RightBlockData = prop.find_all("div", class_="columns small-7 cell")
Rateable_Value = RightBlockData[0].get_text().strip()
print (Rateable_Value)
writer.writerow([Rateable_Value])
Python 2 또는 3을 사용하고 있습니까? –
나는 파이썬 2.7에있다 –
안녕하세요 Odhran,'print Rateable_Value.original_encoding'는 당신을 어떻게 인쇄합니까? – DMPierre