Python
DrBoom
Semi/Solar机械攻城狮
展开
-
Pillow库及缩略图制作
Pillow库及缩略图制作转载 2017-03-29 15:59:26 · 715 阅读 · 0 评论 -
一个小程序,树状目录列表
import osdef fileCntIn(currPath): '''汇总当前目录下文件数''' return sum([len(files) for root, dirs, files in os.walk(currPath)])def dirsTree(startPath): '''树形打印出目录结构''' with open('allfile.tx原创 2017-04-01 17:37:36 · 6328 阅读 · 0 评论 -
python调度框架APScheduler使用详解
python调度框架APScheduler使用详解:from:http://www.cnblogs.com/hushaojun/p/5189109.html 1 # coding=utf-8 2 """ 3 Demonstrates how to use the background scheduler to schedule a job that execut转载 2017-04-01 13:34:07 · 463 阅读 · 0 评论 -
python中的try/except/else/finally语句
与其他语言相同,在python中,try/except语句主要是用于处理程序正常执行过程中出现的一些异常情况,如语法错误(python作为脚本语言没有编译的环节,在执行过程中对语法进行检测,出错后发出异常消息)、数据除零错误、从未定义的变量上取值等;而try/finally语句则主要用于在无论是否发生异常情况,都需要执行一些清理工作的场合,如在通信过程中,无论通信是否发生错误,都需要在通信完成或者转载 2017-03-30 14:11:56 · 509 阅读 · 0 评论 -
一个爬虫
# -*- coding: utf-8 -*-"""Created on Wed Oct 26 11:28:18 2016"""import requestsfrom bs4 import BeautifulSoup#import urllib 已全部被requests代替import osimport reimport timeimport pyp原创 2017-02-23 10:06:54 · 376 阅读 · 0 评论 -
python里星号
作者:kevinfu链接:https://www.zhihu.com/question/20801578/answer/86035017来源:知乎著作权归作者所有,转载请联系作者获得授权。python里星号有两种意思1. 定义函数时一般情况下,函数的参数接受指定个数的参数,比如def func(a, b, c): print a, b, c函数转载 2017-02-21 15:48:43 · 1432 阅读 · 0 评论 -
Python中re(正则表达式)模块学习
Python中re(正则表达式)模块学习今天学习了Python中有关正则表达式的知识。关于正则表达式的语法,不作过多解释,网上有许多学习的资料。这里主要介绍Python中常用的正则表达式处理函数。re.match re.match 尝试从字符串的开始匹配一个模式,如:下面的例子匹配第一个单词。 import retext = "JGood转载 2016-10-25 17:46:21 · 324 阅读 · 0 评论 -
Python数据分析-1
第一次用python进行数据分析,速度很快很强大# -*- coding: utf-8 -*-"""Created on Thu Sep 22 11:39:29 2016import numpy as npimport pandas as pdimport matplotlib.pyplot as pltyindex=np.arange(原创 2016-09-26 17:34:27 · 447 阅读 · 0 评论 -
Python str.format()函数
1 #使用str.format()函数 2 3 #使用'{}'占位符 4 print('I\'m {},{}'.format('Hongten','Welcome to my space!')) 5 >>> I'm Hongten,Welcome to my space! 6 print('#' * 40) 7 8 #也可以使用'{0}','{1}'形式的转载 2016-10-11 17:45:44 · 854 阅读 · 0 评论