后端程序员之路 20、python复习
Welcome to Python.org
https://www.python.org/
怎么用最短时间高效而踏实地学习 Python? - 知乎
https://www.zhihu.com/question/28530832
人生苦短,我用python。
学python是在大二的时候,看的大妈的《可爱的python》一书。
转眼这么多年过去,工作中也用过不少次,有用在批量处理文件和文本的简单任务、定时执行任务、构建机之类的场景。
今天,打算再复习一下python里跟别的常用语言稍有不同的一些语法和特性。
快速入门:十分钟学会Python - 小y - 博客园
http://www.cnblogs.com/tuyile006/p/5596604.html
1、列表生成式,列表推导式
x = [1,2,3,4,5,6,7,8,9,10]
a = range(1, 11)
b = [i*10 for i in a] #10,20...100
c = [i*10 for i in a if i > 4] #50,60...100
Python高级特性之切片 - DacingLink 生命的舞者,SkipList 灵魂的跳跃 - 博客频道 - CSDN.NET
http://blog.csdn.net/qq_33583069/article/details/52194733
2、切片
consequence[start_index: end_index: step]
a = [1,2,3,4,5,6,7,8,9,10]
print a[2:-2] #3,4...8
print a[::-1] #10,9...1
print a[-1:1:-2] #10,8,6,4
Python函数式编程指南(二):函数 - AstralWind - 博客园
http://www.cnblogs.com/huxi/archive/2011/06/24/2089358.html
3、函数式编程
lambda_func = lambda x : x*3
d = map(lambda_func, a)
Python装饰器与面向切面编程 - AstralWind - 博客园
http://www.cnblogs.com/huxi/archive/2011/03/01/1967600.html
4、装饰器
import time
def timeit(func):
def wrapper():
start = time.clock()
func()
end =time.clock()
print 'used:', end - start
return wrapper
@timeit
def foo():
print 'in foo()'
后端程序员之路 20、python复习的更多相关文章
- 后端程序员之路 6、Python fabric
直接写shell固然也很好,但是用python来写脚本,也是美滋滋.fabric是一个封装部署.多机操作等功能的python库. Welcome to Fabric! - Fabric documen ...
- 后端程序员之路 59、go uiprogress
gosuri/uiprogress: A go library to render progress bars in terminal applicationshttps://github.com/g ...
- 后端程序员之路 51、A Tour of Go-1
# A Tour of Go - go get golang.org/x/tour/gotour - https://tour.golang.org/ # welcome - ...
- 后端程序员之路 43、Redis list
Redis数据类型之LIST类型 - Web程序猿 - 博客频道 - CSDN.NEThttp://blog.csdn.net/thinkercode/article/details/46565051 ...
- 后端程序员之路 22、RESTful API
理解RESTful架构 - 阮一峰的网络日志http://www.ruanyifeng.com/blog/2011/09/restful.html RESTful API 设计指南 - 阮一峰的网络日 ...
- 后端程序员之路 16、信息熵 、决策树、ID3
信息论的熵 - guisu,程序人生. 逆水行舟,不进则退. - 博客频道 - CSDN.NEThttp://blog.csdn.net/hguisu/article/details/27305435 ...
- 后端程序员之路 15、Matplotlib
Matplotlib: Python plotting - Matplotlib 2.0.0 documentationhttp://matplotlib.org/ matplotlib-绘制精美的图 ...
- 后端程序员之路 14、NumPy
NumPy - NumPyhttp://www.numpy.org/ NumPy-快速处理数据 - 用Python做科学计算http://old.sebug.net/paper/books/scipy ...
- 后端程序员之路 13、使用KNN进行数字识别
尝试一些用KNN来做数字识别,测试数据来自:MNIST handwritten digit database, Yann LeCun, Corinna Cortes and Chris Burgesh ...
随机推荐
- codeforces628D. Magic Numbers (数位dp)
Consider the decimal presentation of an integer. Let's call a number d-magic if digit d appears in d ...
- hdu3577 Fast Arrangement
Problem Description Chinese always have the railway tickets problem because of its' huge amount of p ...
- Intelligent IME HDU - 4287 字典树
题意: 给你m个字符串,每一个字符对应一个数字,如下: 2 : a, b, c 3 : d, e, f 4 : g, h, i 5 : j, k, l 6 : m, n, o ...
- Git关联GitHub
1.打开git命令行工具 2.设置全局用户名.邮箱 git config --global user.name "your_name" git config --global us ...
- Nginx 动静分离概述
目录 Nginx 动静分离是什么 Nginx 动静分离配置 Nginx 动静分离是什么 Nginx 动静分离,指的是静态资源请求由 Nginx 处理,动态资源请求由 php-fpm 处理或 tomca ...
- 【原创】Linux虚拟化KVM-Qemu分析(九)之virtio设备
背景 Read the fucking source code! --By 鲁迅 A picture is worth a thousand words. --By 高尔基 说明: KVM版本:5.9 ...
- oslab oranges 一个操作系统的实现 实验二 认识保护模式
https://github.com/yyu/osfs00 实验目的: 理解x86架构下的段式内存管理 掌握实模式和保护模式下段式寻址的组织方式. 关键数据结构.代码组织方式 掌握实模式与保护模式的切 ...
- IO - 同步,异步,阻塞,非阻塞 (亡羊补牢篇)【转】
同步(synchronous) IO和异步(asynchronous) IO,阻塞(blocking) IO和非阻塞(non-blocking)IO分别是什么,到底有什么区别? 详细请看下链接: IO ...
- codeforces 7D
D. Palindrome Degree time limit per test 1 second memory limit per test 256 megabytes input standard ...
- MATLAB中将mat文件转为txt格式文件
直接保存为txt文件: 可以用fprintf函数,来代替save函数 比如现在我有一个变量a=[0.1223 345.4544] 如果我想保存它的话,可以用下面的程序: fid = fopen(' ...