随笔分类 -  Python

摘要:1.解决乱码问题: pyhton中内部所有编码是Unicode,中文是gbk;正常情况下,我们输出的是utf-8; 我们可以采用sys.getdefaultencoding()查看系统默认的编码; 解决方法有如下几种: 1.在文件开头添加上:#coding:utf-8或者# -*- coding:u 阅读全文
posted @ 2018-08-04 22:30 goodTOgreat 阅读(1405) 评论(0) 推荐(0)
摘要:一、清楚学习目标 无论是学习什么知识,都要有一个对学习目标的清楚认识。 只有这样才能朝着目标持续前进,少走弯路,从学习中得到不断的提升,享受python学习计划的过程。 二、基本python 知识学习 1. 了解Python是什么,都能做些什么? 2. 知道什么是变量、算法、解释器 3. Pytho 阅读全文
posted @ 2018-08-04 22:10 goodTOgreat 阅读(909) 评论(0) 推荐(0)
摘要:本文旨在学习python中有关线程的基础知识,上述代码都是一个个相关的实例,仅供参考。 阅读全文
posted @ 2018-07-24 20:53 goodTOgreat 阅读(273) 评论(0) 推荐(0)
摘要:'''使用装饰器对文件进行读写操作''' # def check_permission(func): # '''演示嵌套函数定义及使用''' # def wrapper(*args,**kwargs): # '''*args:接收任意多个实参并存入元组中;**kwargs:接收关键字参数显示赋值并存入字典中''' # if kwargs.get('... 阅读全文
posted @ 2018-06-08 20:00 goodTOgreat 阅读(529) 评论(0) 推荐(0)
摘要:#!/user/bin/env python # @Time :2018/6/5 14:58 # @Author :PGIDYSQ #@File :PyCheck.py from os.path import isfile as isfile from time import time as time Result ={} AllLines =[] FileName = ... 阅读全文
posted @ 2018-06-08 19:58 goodTOgreat 阅读(714) 评论(0) 推荐(0)
摘要:#!/user/bin/env python # @Time :2018/6/7 16:31 # @Author :PGIDYSQ #@File :PerformTaskTimer.py #定时执行任务命令 #1.定时任务代码 import time,os,sched # schedule = sched.scheduler(time.time,time.sleep) # ... 阅读全文
posted @ 2018-06-08 19:57 goodTOgreat 阅读(15410) 评论(0) 推荐(0)
摘要:#!/user/bin/env python # @Time :2018/6/6 10:10 # @Author :PGIDYSQ #@File :FileBackup2.py import os import filecmp import shutil import sys import time,sched '''定时任务备份,增量备份''' schedule = ... 阅读全文
posted @ 2018-06-08 19:57 goodTOgreat 阅读(2061) 评论(0) 推荐(0)
摘要:'''自定义数组类,实现数组中数字之间的四则运算,内积运算,大小比较,数组元素访问修改及成员测试等功能''' class MyArray: '''保证输入值为数字元素(整型,浮点型,复数)''' def ___isNumber(self, n): if not isinstance(n,(int,float,complex)): retur... 阅读全文
posted @ 2018-06-08 19:54 goodTOgreat 阅读(6181) 评论(0) 推荐(0)
摘要:#!/user/bin/env python # @Time :2018/6/8 14:44 # @Author :PGIDYSQ #@File :CreateFunTest.py '''如何在sqlite3连接中创建并调用自定义函数''' import sqlite3,hashlib #自定义函数 def md5sum(t): return hashlib.md5... 阅读全文
posted @ 2018-06-08 19:52 goodTOgreat 阅读(1783) 评论(0) 推荐(0)
摘要:import itertools'''chain:连接两个列表进行迭代 count:从指定值开始,进入一个无界循环中 cycle:生成无界迭代器 filterfalse:返回一个可以使fun返回False的迭代器(python3.x中没有ifilter) islice:返回一个迭代器,并指定star 阅读全文
posted @ 2018-05-29 17:13 goodTOgreat 阅读(801) 评论(0) 推荐(0)
摘要:''' Created on 2018-5-27 @author: yaoshuangqi ''' #本代码获取百度乐彩网站上的信息,只获取最近100期的双色球 import urllib.request from bs4 import BeautifulSoup import random ere_hitlist = [] hitlist = [] def getSSQ100(): ... 阅读全文
posted @ 2018-05-27 21:16 goodTOgreat 阅读(401) 评论(0) 推荐(0)
摘要:1 # ''' 2 # Created on 2018-5-26 3 # 4 # @author: yaoshuangqi 5 # ''' 6 import urllib.request 7 import urllib.parse 8 import json 9 10 class YoudaoFanyi(): 11 """ 12 有道词典API 13 ... 阅读全文
posted @ 2018-05-27 17:38 goodTOgreat 阅读(5226) 评论(0) 推荐(0)
摘要:相关资料:https://www.cnblogs.com/lyox/p/8671098.html 阅读全文
posted @ 2018-05-19 10:26 goodTOgreat 阅读(239) 评论(0) 推荐(0)