02 2018 档案

摘要:1.操作excel xlrd 读 xlwt 写 xlutils 修改2.网络编程 urllib url编码 requests模块 r = requests.get(url, data={'x': y}, headers={'x': y}, cookies={'x': y}) r = requests 阅读全文
posted @ 2018-02-09 16:34 王思磊 阅读(119) 评论(0) 推荐(0)
摘要:class WslFather(object): @property def money(self): return 1000000000 def smoke(self): self.yan = '玉溪' print('抽烟') def drink(self): print('喝酒') def ta 阅读全文
posted @ 2018-02-09 16:33 王思磊 阅读(111) 评论(0) 推荐(0)
摘要:class Car(object): # 模型,模板 def __init__(self, color, window): # 构造函数,类在初始化的时候会执行它,顺序无所谓,可以写在最下面 # 如果你的类在实例化的时候要传入一些参数,那么你就要在__init__这个函数里写参数了 self.col 阅读全文
posted @ 2018-02-09 16:33 王思磊 阅读(133) 评论(0) 推荐(0)
摘要:import redisclass MyRedis(object): xiaohei = 'hahaha' def __init__(self, host, password='', port=6379): self.__host = host self.password = password se 阅读全文
posted @ 2018-02-09 16:32 王思磊 阅读(127) 评论(0) 推荐(0)
摘要:import requestscookies = 'dy_did=d94fe220c9ac1c014987ec5e00061501; _dys_refer_action_code=init_page_studio_v; acf_yb_auth=e5a8f675af47acaeaf434cad9406 阅读全文
posted @ 2018-02-09 16:30 王思磊 阅读(648) 评论(0) 推荐(0)
摘要:# import traceback# import pymysql# def calc(a, b):# res = (a / b)# return res### def main():# money = input('输入多少钱:')# months = input('还几个月:')# try:# 阅读全文
posted @ 2018-02-09 16:29 王思磊 阅读(166) 评论(0) 推荐(0)
摘要:# 签名 为了防止作弊# 1.用户设备号码MD5加密一次# 2.再取加密后的前10位# 3.再加盐,再给他md5一次# 4.生成一个字符串from hashlib import md5class GetSign(object): slat = 'WSL234_#$%_12' def __init__ 阅读全文
posted @ 2018-02-09 16:21 王思磊 阅读(210) 评论(0) 推荐(0)
摘要:class Person(object): country = 'China' # 类变量 def __init__(self, name, age, sex): self.name = name # 实例变量,必须实例化才能用,也叫成员变量 self.age = age self.sex = se 阅读全文
posted @ 2018-02-09 16:20 王思磊 阅读(133) 评论(0) 推荐(0)
摘要:import smtplib # 发邮件的from email.mime.text import MIMEText # 构造邮件内容的,对象username = '18033551998@163.com'password = 'jiqiren123'msg = MIMEText('你好,快过年了,新 阅读全文
posted @ 2018-02-09 16:19 王思磊 阅读(178) 评论(0) 推荐(0)
摘要:import urllib.parses = 'tiger自动化测试'print(urllib.parse.quote(s)) # url编码print(urllib.parse.quote_plus(s)) # url编码src = 'https://www.baidu.com/s?wd=best 阅读全文
posted @ 2018-02-09 16:18 王思磊 阅读(310) 评论(0) 推荐(0)
摘要:class My(object): def __init__(self, name, skill): self.name = name self.skill = skill self.cry() def cry(self): # 实例方法,必须实例化之后才可以调用 print('%s在哭。。。' % 阅读全文
posted @ 2018-02-09 16:17 王思磊 阅读(131) 评论(0) 推荐(0)
摘要:import pymysqlclass OpMySql1: # 经典类 passclass OpMySql(object): # 新式类 def __init__(self, host, user, password, db, port=3306, charset='utf8'): schema = 阅读全文
posted @ 2018-02-09 16:16 王思磊 阅读(375) 评论(0) 推荐(0)
摘要:import xlwt# book = xlwt.Workbook() # 新建一个excel# sheet = book.add_sheet('sheet1') # 添加一个sheet页# sheet.write(0, 0, '姓名')# sheet.write(0, 1, '性别')# shee 阅读全文
posted @ 2018-02-02 22:23 王思磊 阅读(136) 评论(0) 推荐(0)
摘要:# import urllib.request# import jsonimport requests# url = 'http://api.nnzhp.cn/api/user/stu_info?stu_name=ybq123'# res = urllib.request.urlopen(url) 阅读全文
posted @ 2018-02-02 22:22 王思磊 阅读(129) 评论(0) 推荐(0)
摘要:import pymysqlconn = pymysql.connect(host='211.149.218.16', user='jxz', password='123456', db='jxz', port=3306, charset='utf8')cur = conn.cursor(curso 阅读全文
posted @ 2018-02-02 22:21 王思磊 阅读(313) 评论(0) 推荐(0)