随笔分类 -  python

摘要:import sys, re from handlers import HTMLRenderer from util import blocks from rules import rule_list #将文本转成网页 class Parser: def __init__(self, handler 阅读全文
posted @ 2020-05-18 16:52 王者2 阅读(925) 评论(0) 推荐(0)
摘要:import sys import os import glob from os import path from aip import AipOcr from PIL import Image from tkinter import * import tkinter.filedialog root 阅读全文
posted @ 2020-05-18 16:47 王者2 阅读(274) 评论(0) 推荐(0)
摘要:# -*- coding: utf-8 -*- import os import sys import jieba import codecs import math import jieba.posseg as pseg names = {} relationships = {} lineName 阅读全文
posted @ 2020-05-18 16:45 王者2 阅读(218) 评论(0) 推荐(0)
摘要:from collections import Counter import re filename='中国姓名.txt' words=re.findall('\w+',open(filename).read().lower()) str=Counter(words).most_common(100 阅读全文
posted @ 2020-05-18 16:40 王者2 阅读(162) 评论(0) 推荐(0)
摘要:import os import codecs import chardet word_lst = [] word_dict = {} infile=input("请输入统计文件名:") outfile=input("请输入输出结果文件名:") exclude_str = input("请输入过滤字 阅读全文
posted @ 2020-05-18 16:37 王者2 阅读(266) 评论(0) 推荐(0)
摘要:import os libs = {"numpy", "whell", "flask"} try: for lib in libs: os.system("pip install " + lib) print("Successful") except: print("Failed") 阅读全文
posted @ 2020-05-18 16:33 王者2 阅读(164) 评论(0) 推荐(0)
摘要:import urllib3 import urllib import http.cookiejar import webbrowser #声明一个CookieJar对象实例来保存cookie #利用urllib2库的HTTPCookieProcessor对象来创建cookie处理器 #此处的ope 阅读全文
posted @ 2020-05-18 16:32 王者2 阅读(975) 评论(0) 推荐(0)
摘要:import json import requests import re import time from requests.exceptions import RequestException def get_one_page(url): try: headers = { 'User-Agent 阅读全文
posted @ 2020-05-18 16:30 王者2 阅读(182) 评论(0) 推荐(0)
摘要:#抓取淘宝数据 import re import requests from bs4 import BeautifulSoup import string import os import sqlite3 class Getdata: def getHTMLText(url,header): try 阅读全文
posted @ 2020-05-18 16:27 王者2 阅读(386) 评论(0) 推荐(0)
摘要:#模仿浏览器 #下载地址 #创建数据库 #初始化downloadSpider文件夹 #访问京东页面 #数据库增删改查 from selenium.webdriver.common.keys import Keys from selenium import webdriver import threa 阅读全文
posted @ 2020-05-18 16:18 王者2 阅读(289) 评论(0) 推荐(0)
摘要:import sqlite3 def CreateDataBase(): try: db =sqlite3.connect("taobao.db") except: print("创建数据库失败") try: db.execute('create table GoodMsg(id varchar(1 阅读全文
posted @ 2020-05-18 16:16 王者2 阅读(182) 评论(0) 推荐(0)
摘要:#coding=utf-8 print("你好,我是测试文件") def Texts(): return [6, 2, 3, 1, 5, 4] using IronPython.Hosting; namespace LanguageCall { class Program { static void 阅读全文
posted @ 2020-05-18 16:07 王者2 阅读(310) 评论(0) 推荐(0)
摘要:import requests import bs4 from bs4 import BeautifulSoup def getHTMLText(url): try: r=requests.get(url ) r.raise_for_status() r.encoding=r.apparent_en 阅读全文
posted @ 2020-05-18 16:06 王者2 阅读(158) 评论(0) 推荐(0)
摘要:from selenium import webdriver import time driver=webdriver.Chrome() driver.get('https://www.icourse163.org') button1=driver.find_element_by_xpath('/h 阅读全文
posted @ 2020-05-18 16:05 王者2 阅读(230) 评论(0) 推荐(0)
摘要:import os import xlrd import pandas as pd import tkinter as tk from tkinter import filedialog root = tk.Tk() root.title("Excel处理") root.geometry('700x 阅读全文
posted @ 2020-05-18 16:02 王者2 阅读(142) 评论(0) 推荐(0)
摘要:import requests import json page=1 while True: url='http://www.kfc.com.cn/kfccda/ashx/GetStoreList.ashx?op=cname' data={ 'cname':'广州', 'pageIndex': pa 阅读全文
posted @ 2020-05-18 15:42 王者2 阅读(155) 评论(0) 推荐(0)
摘要:为了将python打包成exe程序,拖了三天才搞定。中间报错了几次,下面我就分享一下报错与解决办法 1. 打包的时候一定要使用管理员命令运行 2. 找不到模块 按网上的说法试了一下,一个都没有成功。因为我用的Anaconda环境,最后我把Anaconda环境卸载了,重新使用pip安装需要的包,就没有 阅读全文
posted @ 2020-04-26 14:20 王者2 阅读(277) 评论(0) 推荐(0)
摘要:1 import itchat 2 import pandas as pd 3 4 inchat.auto_login(hotReload=True) 5 friends=itchat.get_friends(update=True)[0:] 6 7 list=[] 8 for x in frien 阅读全文
posted @ 2020-04-23 22:43 王者2 阅读(384) 评论(0) 推荐(0)
摘要:class Animal: def __init__(self, name, color): self.name=name self.color=color def eat(self): print('吃') def drink(self): print('喝') def run(self): pr 阅读全文
posted @ 2019-12-02 20:25 王者2 阅读(192) 评论(0) 推荐(0)
摘要:子类继承自父类之后,如果子类没有写构造函数,默认用父类的构造函数,传入父类的参数 class Animal: def __init__(self, name, color): self.name=name self.color=color def eat(self): print('吃') def 阅读全文
posted @ 2019-12-02 20:07 王者2 阅读(299) 评论(0) 推荐(0)