Python

Python 装饰器小结

#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019/6/3 13:36 # @Author : Ropon # @File : 12_02.py # 装饰器 # def warpper(fn): # def inner(): # print("装饰函数执行前"...

Python模块之pymysql使用

#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/11/17 11:28 # @Author : Ropon # @File : 55_01_pymysql.py import pymysql # user = input('请输入用户名:') # pwd = input(...

Python之类、异常处理总结

#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/10/26 11:17 # @Author : Ropon # @File : 26_01.py # 选课作业 # total_course_list = [] # # class Course: # def __ini...

Python之类二

#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/10/19 15:27 # @Author : Ropon # @File : 23_01.py # 类的成员,主要有三类 # 变量 # 实例变量(字段) # 公有实例...

Python之类一

#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/10/18 16:14 # @Author : Ropon # @File : 22_01.py #1、面向过程编程 #2、函数式编程 # def func(arg): # pass ...

Python之模块导入

#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/10/18 15:07 # @Author : Ropon # @File : 21_01.py # 给导入模块起个别名,以后可通过别名调用此模块 import pickle as pk # ...

Python 之异常处理

#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/10/17 14:24 # @Author : Ropon # @File : 20_01.py # 异常是什么,比如: # IndexError [][1] # KeyError {}['key'] # EOFErro...

Python之常用模块二

#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/10/15 10:30 # @Author : Ropon # @File : 19_01.py import os # os.path.abspath # 将路径中不规范的/ 改成当前操作系统默认格式...

Python之常用模块一

#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2018/10/14 14:27 # @Author : Ropon # @File : 18_01.py #常用模块一 # random # time # os # sys # 序列化模块 # json ...

Python 发红包算法

#算法一 思路 sum =0 amount=500分 count=4个人抢 1 - 500-(4-1-0) -0 i = 0 1. 1 - 1-497 num = 400 sum = sum + num 0+400 1 - 500-(4-1-1) -400 2. 1 - 82 num = 50 sum = sum + num 400 +50 1- 5...