我正在尝试将列表拆分为单独的单元格。
但是,没有分隔列表的逗号分隔符,只有换行符。
我已经阅读了其他一些具有相同属性错误的帖子,但仍然没有弄清楚我哪里出错了。
我的相关代码:
from selenium import webdriver
ChromeOptions = webdriver.ChromeOptions()
driver = webdriver.Chrome('/Users/jones/Downloads/chromedriver')
driver.get('https://www.linkedin.com/in/pauljgarner/')
rows = []
name = sel.xpath('normalize-space(//li[@class="inline t-24 t-black t-normal break-words"])').extract_first()
experience = driver.find_elements_by_xpath('//section[@id = "experience-section"]/ul//li')
rows.append([name])
for item in experience:
rows[0].append(item.text)
print(item.text)
print("")
with open(parameters.file, 'w', encoding='utf8') as file:
writer = csv.writer(file)
for row in rows:
writer.writerow(row.split('\n'))
该列表来自抓取“经验”:
Freelance Python Developer
Company Name
Depop
Dates Employed
Jun 2015 – Present
Employment Duration
4 yrs 11 mos
我的代码的最后四行似乎应该可以解决问题,但是我收到了属性错误。我哪里错了?非常感谢您的帮助

