wapptm's recent timeline updates
wapptm

wapptm

V2EX member #99734, joined on 2015-02-24 12:28:02 +08:00
wapptm's recent replies
Apr 4, 2025
Replied to a topic by v2exgo 职场话题 面试快 2 个月了,最终被迫去苏州了
@v2exgo 考公圣体有先天也有后天,工科考公还是有优势的
Mar 29, 2025
Replied to a topic by v2exgo 职场话题 面试快 2 个月了,最终被迫去苏州了
不错,年轻,还有两年时间可以考公务员。
建议去医院看看吧。就算是有怀疑,别人也不会闲成这样天天盯着你的。
Feb 1, 2024
Replied to a topic by icoming VPS 嗯,搬瓦工的 The Plan 返场!
太贵了
Oct 16, 2023
Replied to a topic by bigfa 分享创造 分享一款自己写的 Hugo / Wordpress 主题
很简洁,速度也快,挺不错的。
这个很常见,有些内容是包裹在 js 里面的,这种肯定匹配不出来。可以将获取的源代码在 scrapy 里面打印出来看看,用正则一般可以匹配出来
Jun 25, 2022
Replied to a topic by lovezww2011 Python 基于 Python 的种子磁力链接搜索网站
看起来很厉害的样子
多谢 4 楼的解释
我找到问题所在了,之前 CSV 文件写入完成后,没有关闭,导致在后面执行 next ()函数时,实际上已经执行到最后一条记录了
在 循环体后加了个 f.close()就解决这个问题了
这两段代码是一样的,运行结果却不一样,唯一能解释的就是运行出错的这个文件中的相关代码导致了此类问题

在这段代码之前有这么一段代码,我想应该是导致出现此类问题的原因所在:
f=open('update.csv',mode='a',encoding='utf-8',newline='')
csv_writer=csv.DictWriter(f,fieldnames=['title','version','href'])
csv_writer.writeheader()#写入表头

items=driver.find_elements(By.CSS_SELECTOR,'.structItem-cell:nth-child(2)')
for item in items:
#获取子网页链接地址
href=item.find_element(By.CSS_SELECTOR,'.structItem-title a').get_attribute('href')
#获取子网页标题
title=item.find_element(By.CSS_SELECTOR,'.structItem-title a').text
try:
#获取子网页版本号,如果无版本号就返回空值
item.find_element(By.CSS_SELECTOR,'.structItem-title span')
version=item.find_element(By.CSS_SELECTOR,'.structItem-title span').text
except:
version='null'
dict={
'title':title,
'version': version,
'href': href,
}
print(dict)
csv_writer.writerow(dict)


with open('update.csv',mode='r',encoding='utf-8') as f:
f_csv=csv.reader(f)
print(f_csv)
header=next(f_csv)
for i in f_csv:
print(i)
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3066 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 22ms · UTC 14:05 · PVG 22:05 · LAX 07:05 · JFK 10:05
♥ Do have faith in what you're doing.