
python手记
文章平均质量分 66
python手记
麦好
硕士/量化投资协会成员
展开
-
python2手记-除法
>>> from __future__ import division>>> 5/22.5>>> 5//22>>>原创 2018-09-28 15:27:39 · 463 阅读 · 0 评论 -
python 3随笔-input与eval
>>> s= input('--> ')--> hello,world>>> s'hello,world'>>> input([prompt])如果存在提示参数,则将其写入标准输出,而不使用尾随换行符。然后,函数从输入中读取一行,将其转换为字符串(去掉尾随的换行符),并返回该字符串。当读取EOF时,会引发EOFEr...原创 2018-09-10 09:10:30 · 1858 阅读 · 0 评论 -
pygame随笔-窗口内图像抖动
#!/usr/bin/env python2# -*- coding: utf-8 -*-"""Created on Mon Aug 27 11:16:32 2018@author: myhaspl"""import sys, pygamepygame.init()size = width, height = 320, 240speed = [2, 2]black =...原创 2018-08-30 18:40:50 · 5332 阅读 · 0 评论 -
python标准库手记【3】
# -*- coding: utf-8 -*-"""Spyder EditorThis is a temporary script file."""import repattern="媒体"text="过度消费消费的另一个显著现象是网购和社交媒体在其中起到了推波助澜的作用。相当比例的受访者认为社交媒体增强了他们的购物欲(中国大陆72%、香港66%、台湾55%、德国23%、意大利4原创 2017-05-18 22:56:04 · 755 阅读 · 0 评论 -
python标准库手记【2】
bogon:pylearn myhaspl$ python learn1.pyInfo: name:myhasplage:26welcome to china # -*- coding:utf-8 -*-import stringvalues={'name':'myhaspl','age':26}t=string.Template("""name:$nameage:$agewelcom原创 2017-05-15 21:29:05 · 542 阅读 · 0 评论 -
python标准库手记【1】
# -*- coding:utf-8 -*-import stringmyStr1="hello,world"myStr2="您好,世界"print myStr1print myStr2print "=========="print string.capwords(myStr1)transTable=string.maketrans('elo您','ELO你')print myS原创 2017-05-14 11:42:32 · 597 阅读 · 0 评论 -
python手记-twisted(4)
from twisted.internet.protocol import Protocolfrom twisted.internet import reactorfrom twisted.internet.protocol import Factoryfrom twisted.internet.endpoints import TCP4ServerEndpoint#http://blog原创 2016-07-09 17:22:10 · 3735 阅读 · 0 评论 -
python手记-twisted(3)
from twisted.internet.protocol import Protocolfrom twisted.internet import reactorfrom twisted.internet.protocol import Factoryfrom twisted.internet.endpoints import TCP4ServerEndpointclass Echo(原创 2016-07-08 18:48:12 · 3396 阅读 · 0 评论 -
python手记-twisted(2)
关闭连接Xshell 5 (Build 0655)Copyright (c) 2002-2015 NetSarang Computer, Inc. All rights reserved.Type `help' to learn how to use Xshell prompt.[c:\~]$ telnet 120.55.*.* 8001Connecting to 120.55.*.*:8001.原创 2016-07-07 17:51:07 · 2726 阅读 · 0 评论 -
python手记-twisted(1)
python手记原创 2016-07-07 10:30:39 · 1840 阅读 · 0 评论 -
python手记(53)
import sys import pygamefrom pygame.locals import *import timeimport mathpygame.init()screen=pygame.display.set_mode((500,550))myfont=pygame.font.Font(None,30)red=(255,0,0)green=(0,255,0)bl原创 2016-01-04 15:42:53 · 1250 阅读 · 1 评论 -
python手记(52)
import sys import pygamefrom pygame.locals import *import timepygame.init()screen=pygame.display.set_mode((500,550))myfont=pygame.font.Font(None,30)red=(255,0,0)green=(0,255,0)textImage=myfont.render原创 2015-12-31 14:58:29 · 1645 阅读 · 0 评论 -
python手记(51)
python 类class Mytest(object): nownum=0 def __init__(self,value=100): self.nownum=value def inCrease(self): self.nownum+=1 def deCrease(self): self.nownum-=1 def toS原创 2015-12-30 11:52:31 · 1556 阅读 · 0 评论 -
wxpython-输出重定向
2、重定向输出输出由控制台重定向到窗口mport wximport sysclass Frame(wx.Frame): def __init__(self,parent,id,title): print "frame init ..." wx.Frame.__init__(self,parent,id,title)class App(wx原创 2014-03-19 18:04:00 · 2682 阅读 · 0 评论 -
wxpython-简单的窗口
1、简单的窗口import wx class MyApp(wx.App):def OnInit(self):frame=wx.Frame(parent=None,id=-1,title="hello")frame.Show()return Trueif __name__=='__main__':app=MyApp()app.MainLoop()原创 2014-03-19 17:39:40 · 1655 阅读 · 0 评论 -
python手记(50)
#!/usr/bin/env python # -*- coding: utf-8 -*-#http://blog.youkuaiyun.com/myhaspl #code:myhaspl@qq.com import waveimport pylab as plimport numpy as npprint 'http://blog.youkuaiyun.com/myhaspl' print '原创 2013-08-29 10:22:52 · 2081 阅读 · 0 评论 -
python手记(49)
#!/usr/bin/env python # -*- coding: utf-8 -*-#http://blog.youkuaiyun.com/myhaspl #code:myhaspl@qq.com import waveimport pylab as plimport numpy as npimport copyprint 'http://blog.youkuaiyun.com/myhaspl原创 2013-08-27 18:21:57 · 1791 阅读 · 0 评论 -
python手记(48)
#!/usr/bin/env python # -*- coding: utf-8 -*-#http://blog.youkuaiyun.com/myhaspl #code:myhaspl@qq.com import waveimport pylab as plimport numpy as npimport copyprint 'http://blog.youkuaiyun.com/myhaspl原创 2013-08-27 17:41:58 · 1729 阅读 · 0 评论 -
python手记(47)
#!/usr/bin/env python # -*- coding: utf-8 -*-#http://blog.youkuaiyun.com/myhaspl #code:myhaspl@qq.com import waveimport pylab as plimport numpy as npimport copyprint 'http://blog.youkuaiyun.com/myhaspl原创 2013-08-26 18:08:14 · 1864 阅读 · 0 评论 -
python手记(46)
#!/usr/bin/env python # -*- coding: utf-8 -*-#http://blog.youkuaiyun.com/myhaspl #code:myhaspl@qq.com import waveimport pylab as plimport numpy as npprint 'http://blog.youkuaiyun.com/myhaspl' print 'm原创 2013-08-26 17:42:23 · 2075 阅读 · 0 评论 -
python手记(45)
python 声音编辑,减少音量#!/usr/bin/env python # -*- coding: utf-8 -*-#http://blog.youkuaiyun.com/myhaspl #code:myhaspl@qq.com import waveimport pylab as plimport numpy as npprint 'http://blog.youkuaiyun.com/m原创 2013-08-26 15:38:01 · 1660 阅读 · 0 评论 -
python手记(44)
#!/usr/bin/env python# -*- coding: utf-8 -*-#http://blog.youkuaiyun.com/myhaspl#code:myhaspl@qq.comimport waveimport pylab as plimport numpy as npprint 'http://blog.youkuaiyun.com/myhaspl'print 'myhaspl@原创 2013-08-26 12:00:34 · 2196 阅读 · 0 评论 -
python手记(43)
>>> runfile(r'K:\testpro\test.py', wdir=r'K:\testpro')http://blog.youkuaiyun.com/myhasplmyhaspl@qq.comworking...>>> python对声音处理显示一段语音的波形#!/usr/bin/env python # -*- coding: ut原创 2013-08-26 10:21:43 · 2202 阅读 · 3 评论 -
python手记(42)
#!/usr/bin/env python#-*- coding: utf-8 -*-#code:myhaspl@qq.comimport cv2import numpy as npfn1="he2.jpg"fn2="he1.jpg"if __name__ == '__main__': print 'http://blog.youkuaiyun.com/myhaspl' pr原创 2013-08-24 22:38:41 · 1422 阅读 · 0 评论 -
python手记(41)
python opencv图片融合#!/usr/bin/env python#-*- coding: utf-8 -*-#code:myhaspl@qq.comimport cv2import numpy as npfn1="he1.jpg"fn2="he2.jpg"if __name__ == '__main__': print 'http://blog.csdn.原创 2013-08-24 21:07:35 · 1608 阅读 · 0 评论 -
python手记(40)
#!/usr/bin/env python#-*- coding: utf-8 -*-#code:myhaspl@qq.comimport cv2import numpy as npfn="test1.jpg"if __name__ == '__main__': print 'http://blog.youkuaiyun.com/myhaspl' print 'myhaspl@原创 2013-08-24 20:45:14 · 1611 阅读 · 0 评论 -
python手记(39)
#!/usr/bin/env python#-*- coding: utf-8 -*-#code:myhaspl@qq.comimport cv2import numpy as npfn="test1.jpg"print 'http://blog.youkuaiyun.com/myhaspl'print 'myhaspl@qq.com'printprint 'loading %s ...原创 2013-08-24 09:38:07 · 1796 阅读 · 0 评论 -
python手记(38)
runfile(r'K:\testpro\testopencv.py', wdir=r'K:\testpro')http://blog.youkuaiyun.com/myhasplmyhaspl@qq.comloading test.png ...working . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .原创 2013-08-23 15:23:22 · 1527 阅读 · 0 评论 -
python手记(37)
#!/usr/bin/env python#-*- coding: utf-8 -*-#code:myhaspl@qq.comimport cv2import numpy as npfn="test1.jpg"if __name__ == '__main__': print 'http://blog.youkuaiyun.com/myhaspl' print 'myhaspl@原创 2013-08-23 11:59:01 · 1726 阅读 · 0 评论 -
python手记(36)
#!/usr/bin/env python#-*- coding: utf-8 -*-#code:myhaspl@qq.comimport cv2import numpy as npfn="test.png"if __name__ == '__main__': print 'http://blog.youkuaiyun.com/myhaspl' print 'myhaspl@q原创 2013-08-21 21:13:30 · 1682 阅读 · 0 评论 -
python手记(35)
#!/usr/bin/env python#-*- coding: utf-8 -*-#code:myhaspl@qq.comimport cv2import numpy as npfn="test.png"if __name__ == '__main__': print 'http://blog.youkuaiyun.com/myhaspl' print 'myhaspl@q原创 2013-08-21 17:15:26 · 1580 阅读 · 0 评论 -
python手记(34)
>>> http://blog.youkuaiyun.com/myhasplmyhaspl@qq.comloading test1.jpg ...正在处理中 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .原创 2013-08-21 12:01:25 · 1681 阅读 · 0 评论 -
python手记(33)
python+OPENCV彩色转灰度#!/usr/bin/env python#-*- coding: utf-8 -*-#code:myhaspl@qq.comimport cv2import numpy as npfn="test2.jpg"if __name__ == '__main__': print 'http://blog.youkuaiyun.com/myhaspl原创 2013-08-20 17:12:41 · 1917 阅读 · 0 评论 -
python手记(32)
#!/usr/bin/env python#-*- coding: utf-8 -*-import cv2import numpy as npfn="test2.jpg"if __name__ == '__main__': print 'http://blog.youkuaiyun.com/myhaspl' print 'myhaspl@qq.com' print原创 2013-08-20 17:03:26 · 1539 阅读 · 0 评论 -
python手记(31)
#!/usr/bin/env python#-*- coding: utf-8 -*-import cv2import numpy as npfn="test2.jpg"if __name__ == '__main__': print 'http://blog.youkuaiyun.com/myhaspl' print 'myhaspl@qq.com' print原创 2013-08-20 16:37:21 · 1485 阅读 · 0 评论 -
python手记(30)
#!/usr/bin/env python#-*- coding: utf-8 -*-import cv2import numpy as npfn="test3.png"if __name__ == '__main__': print 'http://blog.youkuaiyun.com/myhaspl' print 'myhaspl@qq.com' print原创 2013-08-20 16:02:43 · 1558 阅读 · 0 评论 -
python手记(29)
#!/usr/bin/env python#-*- coding: utf-8 -*-import cv2import numpy as npfn="test3.png"if __name__ == '__main__': print 'http://blog.youkuaiyun.com/myhaspl' print 'myhaspl@qq.com' print原创 2013-08-20 11:00:10 · 1647 阅读 · 0 评论 -
python手记(28)
#!/usr/bin/env python#-*- coding: utf-8 -*-import cv2import numpy as npfn="test2.jpg"if __name__ == '__main__': print 'http://blog.youkuaiyun.com/myhaspl' print 'myhaspl@qq.com' print原创 2013-08-20 09:47:37 · 1861 阅读 · 0 评论 -
python手记(27)
#!/usr/bin/env python#-*- coding: utf-8 -*-import cv2import numpy as npfn="test2.jpg"if __name__ == '__main__': print 'http://blog.youkuaiyun.com/myhaspl' print 'myhaspl@qq.com' print原创 2013-08-19 17:59:53 · 1437 阅读 · 0 评论 -
python手记(26)
#!/usr/bin/env pythonimport cv2import sysfn="test2.jpg"if __name__ == '__main__': print 'http://blog.youkuaiyun.com/myhaspl' print 'myhaspl@qq.com' print print 'loading %s ...' % fn原创 2013-08-19 15:02:58 · 1548 阅读 · 0 评论