简体   繁体   中英

Why &nbsp replace as A in excel while scrape data from website in python , I am trying to solve it with .replace(' ',"") but still not working

I am using python, Here is my code and screenshot在此处输入图像描述

Category = soup.find('a', class_='article-labels__text b-reith-sans-font').text.replace(' ',"").replace('|',"")

print("""\n""") print("Category: ", Category )

Try to use .get_text() method instead of .text property

Category = soup.find('a', class_='article-labels__text b-reith-sans-font').get_text(strip=True)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM