码迷,mamicode.com
首页 >  
搜索关键字:coding    ( 12955个结果
(转)详解Python闭包
Closures In PythonEntirely copied from here All I want is to mark it, thanks for this nice article.You might have lived a long and happy coding life w...
分类:编程语言   时间:2015-06-30 12:24:32    阅读次数:135
Python学习笔记 - map reduce
#!/usr/bin/env python3 # -*- coding: utf-8 -*- def f(x): return x * x r = map(f, [1, 2, 3, 4, 5, 6, 7, 8, 9]) # 结果r是一个Itertator,是惰性序列 # 通过list()函数让它把整个序列都计算出来并返回一个list print(list(r)) # [1, 4, 9, 16...
分类:编程语言   时间:2015-06-30 09:00:16    阅读次数:163
Raspberry Pi --操作LED
最简单的一个树莓派GPIO操作入门,这里记录以下先上连接图:卧槽。图真特么的大用到了GPIO的GND和#18针脚,这就不上图了,红色的线接的是18针脚,暗色的线接的是GND针脚,下面上Python的代码: 1 #coding:utf-8 2 import GPi.GPIO as GPIO 3 imp...
分类:Web程序   时间:2015-06-29 23:40:47    阅读次数:290
pyglet -- 视频播放器 (简单实现,效果不是太好,切换资源会卡死)(三)
实现一个简单的视频播放器,效果不是很好。这里不多说,直接贴代码了。 1 #-*- coding:gbk -*- 2 import pyglet 3 import os 4 from pyglet.gl import * 5 6 def draw_rec(x,y,width,height...
分类:其他好文   时间:2015-06-29 21:47:46    阅读次数:211
Python3发送post请求,自动记住cookie
在做登录的post请求时,需要记住cookie,否则不能访问登录后的页面。下面是登录的代码:#coding:utf-8import urllibimport http.cookiejarurl = "http://c.highpin.cn/Users/CLogin"postdata =urllib....
分类:编程语言   时间:2015-06-29 19:50:40    阅读次数:111
python 携带cookie访问网站(python接口测试post)
最近在使用自己研究性能测试工具的时候想到,使用python向服务器不断发送数据以作为并发测试。大概情况如下:#coding=utf-8import urllib2import urllibimport cookielibimport osimport threadingimport timecl.....
分类:编程语言   时间:2015-06-29 19:35:40    阅读次数:412
Python 类 setattr、getattr、hasattr 的使用
#coding=utf-8class Employee: '所有员工的基类' empCount = 0 def __init__(self, name, salary): self.name = name self.salary = salary Employee.empCo...
分类:编程语言   时间:2015-06-29 19:28:50    阅读次数:129
nagios检测http和https的插件,python检测http和https的插件
一个检测http和https状态和返回时间的程序,nagios可以使用的插件 代码中饱含注释, 如果不明之处和认为有错误的地方, 请各位指出 #!/bin/env?python #coding:utf8 #############################################...
分类:移动开发   时间:2015-06-29 18:13:18    阅读次数:132
python 装饰器 一 (简单不带参数的函数)
#coding=utf-8#python装饰器'''装饰器可以用def的形式来定义。装饰器接收一个可调用对象作为输入参数,并返回一个新的可调用对象。装饰器新建了一个可调用对象,也就是return返回的函数funx,在新增的函数中,可以添加我们需要的功能,并通过调用原有函数来实现原有函数的功能'''d...
分类:编程语言   时间:2015-06-29 13:01:23    阅读次数:157
pyplot 绘图与可视化
1. 基本使用#!/usr/bin/env python# coding=utf-8import matplotlib.pyplot as pltfrom numpy.random import randn# example 1fig = plt.figure()ax1 = fig.add_subp...
分类:其他好文   时间:2015-06-29 12:57:15    阅读次数:173
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!