我有一个包含多个工作表的Excel文件。我想用pandas将Python中的新数据添加到同一个Excel文件中的新工作表中。在不影响我以前的数据的情况下,这样做是否可行?我是新来的。。。谢谢你的帮助!在
以下是我目前使用的Python代码:
from urllib.request import urlopen
from lxml import html
import cssselect
response = urlopen("https://www.xyz.com.shtml")
content = response.read()
tree = html.fromstring(content)
for div in tree.cssselect('.first_name'):
for a in div.cssselect('table:nth-child(2) a'):
print(a.text)
我在网上找到的。。。我只是有点困惑如何在我目前的情况下使用它:
^{pr2}$
好像你想在一个类中抓取一个网站和一个表元素。我建议你改用beauthoulsoup。在
台阶
将数据框导出到excel
相关问题 更多 >
编程相关推荐