2008-03-01から1ヶ月間の記事一覧

[Python] sys._getframe に渡す depth

>>> import sys >>> for i in range(-1, 100): print '%d: %s' % (i, sys._getframe(i).f_code.co_filename, ) -1: <pyshell#2> 0: <pyshell#2> 1: C:\Python25\lib\idlelib\run.py 2: C:\Python25\lib\idlelib\run.py 3: <string> Traceback (most recent call last): File "<pyshell#2>", line 2, in <module></module></pyshell#2></string></pyshell#2></pyshell#2>…

[Python] Python でオーバーロード、メソッドを

書いた本人に必要性が分からないシリーズ import sys class OverloadMethod(object): def __init__(self): self.functions = [] def __call__(self, *args, **kwargs): for function in self.functions: if len(args) == function.func_code.co_argcount: re…

[Python] Adobe Illustrator の .ai ファイルを PDF に変換する

COM 経由で操作するだけ。Illustrator のファイル形式に対応してるプログラムって全然ないよね。 ダイアログの抑制とか全然できない。超困る。無人処理とかできない。たかだかバッチ処理でスレッド起動して監視かよ。全然手軽じゃない。 import os from win3…