2010年11月9日火曜日

Matplotlib 講義

Matplotlib, the popular 2D Plotting Library


2010年9月28日火曜日

Python オブジェクト指向ゼミ

同志社大学の授業テキスト。Pythonの要点がまとまってます。

2010年9月27日月曜日

eval(), exec() 文字列をそのまま計算

evalで、文字列をそのまま、計算できる。しかし、プログラムを書く人から言わすと、「美しくない」らしい。(涙)
a=1
b=2
eval("a+b")
>> 3

代入は、execを使う。
exec("a=10")
a
>> 10

Compileに関しては、python3.0だけど、分かり易く、詳しく書いてある。
http://d.hatena.ne.jp/kotsubu-chan/20030331

eval(compile("3+4","","eval"))
>> 7

2010年9月25日土曜日

インスタンスをリストに持たせる。

複数のインスタンスを作った場合に、管理するのに便利そう。

http://blogs.yahoo.co.jp/nanashi_hippie/47503485.html


  1. class hello:  
  2.     def __init__(self, num):  
  3.         self.num = num  
  4.         print 'hello init'  
  5.       
  6.     def output(self):  
  7.         print 'hello output'self.num  
  8.   
  9.   
  10. def main():  
  11.     pack = []  
  12.       
  13.     test1 = hello(5)  
  14.     test2 = hello(10)  
  15.       
  16.     pack.append(test1)  
  17.     pack.append(test2)  
  18.       
  19.     print pack  
  20.     for x in [0,1]:  
  21.         pack[x].output()  
  22.       
  23.     pack.pop(0)  
  24.     pack[0].output()  
  25.       
  26.     return  
  27.   
  28. if __name__ == '__main__': main()  

2010年9月16日木曜日

Matplotlib documents

Matplotlib official document

Matplotlib for Python Developers - sample -
"Embedding Matplotlib in Qt 4"



Matplotlib introduction

分かりやすい MatplotlibのShowMeDoでのイントロダクション。

http://showmedo.com/videotutorials/series?name=8phfgGuqi

2010年3月1日月曜日