本文的文字及图片来源于网络,仅供学习、交流使用,不具有任何商业用途,,版权归原作者所有,如有问题请及时联系我们以作处理
作者:种起水稻 来源:CSDN
本文链接:https://blog.csdn.net/qq_43624038/article/details/111826605
私信小编01即可获取大量Python学习资料
众所周知,百度文库不允许非VIP直接复制它的内容,我这种穷鬼对此深恶痛绝,所以决定用python实现对于其内容的爬取
# coding =utf-8import tkinter as tkimport re # 正则表达式import urllibimport requestswindow = tk.Tk()url = ""window.title('百度文库爬虫')window.geometry('500x300')baseNum = tk.Label(window, text='请输入网址:')baseNum.pack()base_text = tk.StringVar()base = tk.Entry(window, textvariable=base_text)base.pack()def xxxx(): print("wo you shuchu") url = base_text.get() content_list = kaishi(url) f = open(r'C:甥敳獲AdministratorDesktop123.txt', 'a+') for i in range(0, len(content_list)): f.write(str(content_list[i])) print("xxxxx") print(str(content_list))def main(): tk.Button(window, text="生成桌面文件", command=xxxx).pack() tk.Button(window, text="退出1", command=window.qui