2008-04-18から1日間の記事一覧

PIL(Python Imaging Library)を使う

(1)PILのインストール (2)コーディング以下は、文字を書いてbmpに保存するだけ。 import Image import ImageDraw import ImageFont im = Image.new("RGB", (320, 200)) draw = ImageDraw.Draw(im) font = ImageFont.truetype("Vera.ttf", 10) draw.setfont(f…

Python一行勉強リスト

検索処理 result = re.match(pat, str)パース re.split(",", "a,b,c,d,r,e,d")置換 re.sub(",", " ", "a,b,c,d,e")型変換 int("123") + 1 str(1234)大文字小文字 "hello world".upper() 先頭と末尾の文字を取り除く ", 123 ".strip(", ") For文 for i in ran…

JAVAで高精度タイマを使う

public static void main(String[] args) { long before = System.nanoTime(); long now; for (int i = 0; i < 10; i++) { try { Thread.sleep(100); } catch (Exception e) { e.printStackTrace(); } now = System.nanoTime(); System.out.println("" + (no…