matplotlib 画图 华氏度-摄氏度转化
摘要:转自:http://www.oschina.net/code/snippet_1174881_24083#!/usr/bin/python# -*- coding: UTF-8 -*-# -*- coding: utf-8 -*-"""Created on Sat Aug 24 15:46:11 2013@author: wangxiaotao"""import numpy as npimport matplotlib.pyplot as pltimport matplotlibF = np.arange(-50, 240, 0.1)
阅读全文
posted @
2013-08-31 13:28
神·鲸落
阅读(560)
推荐(0)
matplotlib画图
摘要:快速绘图¶使用pyplot模块绘图matplotlib的pyplot模块提供了和MATLAB类似的绘图API,方便用户快速绘制二维图表。我们先看一个简单的例子:05-matplotlib/matplotlib_simple_plot.py用pylab库快速绘图import numpy as npimport matplotlib.pyplot as plt ❶x = np.linspace(0, 10, 1000)y = np.sin(x)z = np.cos(x**2)plt.figure(figsize=(8,4)) ❷plt.plot(x,y,label="$sin(
阅读全文
posted @
2013-08-31 13:02
神·鲸落
阅读(3219)
推荐(1)
psyco
摘要:import psycopsyco.full()转自:http://www.ibm.com/developerworks/cn/linux/sdk/python/charm-28/Python 对于您想让它做的事来说通常够快了。编程新手对于类似 Python 这样的解释型/字节编译型语言,将 90% 的关注点集中在执行速度方面,是相当幼稚的。在最新的硬件上,大多数非优化的 Python 程序运行的速度和所需要达到的速度一样快,而且,花费额外的编程工作以使应用程序运行得更快实在没什么意义。因此,在本文,我只对其它的百分之十感兴趣。有时,Python 程序(或用其它语言编写的程序)也会运行得极其缓
阅读全文
posted @
2013-08-31 12:12
神·鲸落
阅读(870)
推荐(0)
matplotlib 模块 画图 例2
摘要:#!/usr/bin/python# -*- coding: UTF-8 -*-import matplotlib.pyplot as pltx=[i for i in range(-20,20)]y=[i**2 for i in x]# plt.plot(x,y)# plt.plot(x,y,color="red",linestyle="-.",marker="o") #linestyle="dashed"虚线 marker="o"表示标记为圆圈# plt.plot(x,y,"ro-
阅读全文
posted @
2013-08-31 00:17
神·鲸落
阅读(397)
推荐(0)
matplotlib 模块 画图 例1
摘要:1 #!/usr/bin/python 2 # -*- coding: UTF-8 -*- 3 4 import matplotlib.pyplot as plt 5 import numpy as np 6 #To draw y =x^2 (-3<=x<=3) 7 x=[x for x in range(100)] 8 y = [ele**2 for ele in x] 9 z = [ele *2 for ele in x]10 # plt.plot(x,y,'ro-',label="y=x^2")#作图:y关于x的曲线 label是曲线标签
阅读全文
posted @
2013-08-31 00:15
神·鲸落
阅读(301)
推荐(0)
threading 模块- 多线程
摘要:#!/usr/bin/python# -*- coding: UTF-8 -*-import threadingimport timeclass timer(threading.Thread): def __init__(self,num,interval): threading.Thread.__init__(self) self.thread_num=num self.interval=interval self.thread_stop=False def run(self): while not self....
阅读全文
posted @
2013-08-31 00:02
神·鲸落
阅读(414)
推荐(0)
win32api window2con 模块 -系统注册表操作
摘要:#!/usr/bin/python# -*- coding: UTF-8 -*-#encoding=utf-8#win32api#注册表操作# 注册表项# HKEY_CLASSES_ROOT# HKEY_CURRENT_USER# HEKY_LOCAL_MACHINE# HKEY_USERS# HKEY_CURRENT_CONFIG import win32apiimport win32con#注册表打开#RegOpenKey(key, subKey , reserved , sam)#RegOpenKeyEx(key, subKey , reserved , sam)#key: HKEY_C
阅读全文
posted @
2013-08-30 23:58
神·鲸落
阅读(1310)
推荐(0)
os 模块 -文件和目录操作
摘要:#!/usr/bin/python# -*- coding: UTF-8 -*-# 目录操作:# os.mkdir("file") 创建目录# 复制文件:# shutil.copyfile("oldfile","newfile") oldfile和newfile都只能是文件# shutil.copy("oldfile","newfile") oldfile只能是文件夹,newfile可以是文件,也可以是目标目录# 复制文件夹:# shutil.copytree("olddir"
阅读全文
posted @
2013-08-30 23:54
神·鲸落
阅读(823)
推荐(0)
math 模块
摘要:#encoding=utf-8# math包from math import *#2个常量#math.e # 自然常数e# math.pi # 圆周率piprint eprint pi# 此外,math包还有各种运算函数 (下面函数的功能可以参考数学手册):# math.ceil(x) # 对x向上取整,比如x=1.2,返回2# math.floor(x) # 对x向下取整,比如x=1.2,返回1# math.pow(x,y) # 指数运算,得到x的y次方# math.log(x) # 对数,默认基底为e。可以使用base参数,来改变对数的基...
阅读全文
posted @
2013-08-30 23:40
神·鲸落
阅读(463)
推荐(0)