摘要: import pymysql db = pymysql.connect(host='localhost', user='root', password='pz2212', port=3306, db='spiders') cursor = db.cursor() data = { 'id': '20120001', 'name': 'Bob', 'age': 20 } t... 阅读全文
posted @ 2019-03-13 16:42 晨光曦微 阅读(223) 评论(0) 推荐(0) 编辑
摘要: import mitmproxy.http from mitmproxy import ctx, http class Joker: def request(self, flow: mitmproxy.http.HTTPFlow): if flow.request.host != "www.baidu.com" or not flow.request.path.sta... 阅读全文
posted @ 2019-03-13 16:41 晨光曦微 阅读(482) 评论(0) 推荐(0) 编辑
摘要: from selenium import webdriver from selenium.webdriver.common.by import By from selenium.webdriver.common.keys import Keys from selenium.webdriver.support import expected_conditions as ec from seleni... 阅读全文
posted @ 2019-03-13 16:39 晨光曦微 阅读(485) 评论(0) 推荐(0) 编辑
摘要: #!python3 #updateProduce.py-更正指定产品 成本价格(第二列) import openpyxl wb=openpyxl.load_workbook('produceSales.xlsx') sheet=wb.active #或sheet=wb['Sheet'] # 需要更新成本价格的产品,字典格式 PRICE_UPDATES = {'Garlic': 3.07, ... 阅读全文
posted @ 2019-03-13 16:33 晨光曦微 阅读(288) 评论(0) 推荐(0) 编辑
摘要: import requests from pyquery import PyQuery as pq url='https://www.zhihu.com/explore' headers={ 'User-Agent':'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Geck... 阅读全文
posted @ 2019-03-13 16:30 晨光曦微 阅读(329) 评论(0) 推荐(0) 编辑
摘要: grid = [['.', '.', '.', '.', '.', '.'], ['.', 'O', 'O', '.', '.', '.'], ['O', 'O', 'O', 'O', '.', '.'], ['O', 'O', 'O', 'O', 阅读全文
posted @ 2019-03-13 16:28 晨光曦微 阅读(98) 评论(0) 推荐(0) 编辑
摘要: name = ''#名字为空即代表False while not name:#not name=False即 真,将执行循环体 print('Enter your name:') name = input()#给name赋值,如输入了空以外值,不会再有下一个循环while print('How many guests will you have?') numOfG... 阅读全文
posted @ 2019-03-13 16:27 晨光曦微 阅读(324) 评论(0) 推荐(0) 编辑
摘要: #让用户输入一个宠物名字,然后检查该名字是否在宠物列表中 myPets = ['Zophie', 'Pooka', 'Fat-tail'] print('Enter a pet name:') name = input() if name not in myPets: print('I do not have a pet named ' + name) else: print(n... 阅读全文
posted @ 2019-03-13 16:25 晨光曦微 阅读(210) 评论(0) 推荐(0) 编辑
摘要: #! python3 # mapIt.py - Launches a map in the browser using an address from the # command line or clipboard. import webbrowser, sys, pyperclip #如果命令输入了参数,就从命令里得到地名 if len(sys.argv) > 1: # Get add... 阅读全文
posted @ 2019-03-13 16:24 晨光曦微 阅读(341) 评论(0) 推荐(0) 编辑
摘要: import requests,re,json,time from requests.exceptions import RequestException headers={ 'User-Agent':'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)' } def get_one_page(url): r=requests.g... 阅读全文
posted @ 2019-03-13 16:23 晨光曦微 阅读(227) 评论(0) 推荐(0) 编辑