python
idã§æå®ããã¯ã¦ãªãã¤ã¢ãªã¼ã®è¨äºä¸è¦§ã表形å¼ã§åå¾ããã http://q.hatena.ne.jp/1220786470 ãããªæãâã®ã¹ã¯ãªããã«ãªãã¾ããã #!/usr/bin/env python # -*- coding: utf-8 -*- import random import datetime, time, sys import base64, sha impâ¦
jkondoããã®ä»æ¥ã®æ¥è¨ãèªãã§ãããã人åã·ã ã·ãã£ãªããã®ãç´¹ä»ããã¦ã¾ãããããã¯ããããï¼ãã©ãä¸æä¸æãç»åã§ã¿ãããããªãã¦ããã©ãã©æ¼«ç»ã¿ããã«ãã¦ã¿ãããªããããã¨æã£ãã®ã§ãpythonã§flashã¢ãã¡ãä½ãã¹ã¯ãªãããæ¸ãã¦ã¿ã¾ãâ¦
ãã¿ããªãã®ã§ææ¸ããã¹ã¯ãªãããè²¼ã£ã¦ã¿ã¾ããmixiã®æ´æ°æ å ±ãRSSã§åå¾ããããªã¼ã¨æã£ã¦ãmixipressã使ã£ã¦ã¿ãã¨ããåããªãã£ãã®ã§ãmixi stationç¨APIã使ã£ã¦ç°¡åã«æ¸ãã¾ãããèªè¨¼ã«ã¯cookieã使ã£ã¦ã¾ãã #!/usr/bin/env python # -*- câ¦
FRBã®ç·æ¥å©ä¸ããåãã¦ãä»æ¥ã®æ¥çµã¯è¥å¹²æ»ãã¾ããããããããå¹´æãããã®ä¸ãã¯ã»ãã¨ã²ã©ãããªãã ãæ¥æ¬ããµããã©ã¤ã åé¡ã®å½±é¿ãä¸çªåãã¦ãã¦ãä¸çåææ ªå®ã®ç½å¼å½¹ã«ãªã£ã¦ãæ°ããã¦ãªãã¾ããããããªããã§ããµããã©ã¤ã åé¡ãåºå§ããâ¦
æ¨æ¥ã®ã¨ã³ããªã¼ã§å¢ãã§æ¸ããã¹ã¯ãªããã¯ããã¾ãã¡ä½¿ããªãï¼æ±ãã®ã§æ¹è¯ãã¦ã¿ã¾ãããæ¹è¯ããã¹ã¯ãªããã¯ã³ã³ã«ç½®ãã¦ããã¾ããç´è¿ã®25æ¥éã§ãæå®ããæ ªã®éæã¨ä¼¼ããããªå¤åãããã¦ããä»ã®éæãæ¤ç´¢ãããã¨ãã§ãã¾ããæ ªä¾¡ã®ãã¼ã¿ã¯â¦
æè¿ããã¢ãã£ã¹ãã«ã飽ãã¦ãã¦ãæ ªä¾¡ã®ãã§ãã¯ã趣å³ã«ãªã£ã¦ãã¾ããããã¡ãã¡ã®ãµã¤ããã¿ãããomega chart ã使ã£ã¦ã¹ã¯ãªã¼ãã³ã°ãã¦ã¿ããã¨ãè²ã éãã§ãããã§ãããããã¡ãã£ã¨ãããªãã¦ããããèªç±ã«ããããã§ããããã«ãªãããããâ¦
peercast ãè¦ã¦ããã¨ãå®æ³åãã®æ²ç¤ºæ¿ãã¥ã¼ã¢ãå¿ é ãªæãã«ãªãã¾ããèªåã¯å®æ³åãã®ãã¥ã¼ã¢ã¨ãã¦ãWindowsã§ã¯ Balloo 㨠Jane ãä½µç¨ãã¦ãã¾ãããMacã«ã¯å®æ³åãã®ãã¥ã¼ã¢ãããã¾ãããï¼ããã®ãããããªããã©ãããç¥ãã¾ãããããï¼ãâ¦
ä¸ã§ã¬ãã¥ã¼ãããé²åããããè³ãã®å·»æ«ã«ãããã®æ³åã¨ãããã®ã使ãã¨æ°å¦ã§ç°¡åã«è¨æ¶ã®ã¢ãã«ãä½ãããã¨ããä»é²ãããã¾ãããã¡ãªã¿ã«ãã¡ãã£ã¨ã°ã°ã£ãã¨ãããæ¬ã®å 容ãããâã« è¡åãã¤ãã£ãè¨æ¶ã®ã·ãã¥ã¬ã¼ã·ã§ã³ ãã®ã¾ãã¾è¼ã£ã¦ã¾ãâ¦
ï¼ã¡ããã®Pythonã¹ã¬ããã¿ã¦ãããããã¼é¢ç½ããã¨ããã³ã¼ãããã£ãã®ã§ãåæã«ã¾ã¨ãã¦ã¹ã¬ãã転è¼ãã¦ã¿ã¾ããã転è¼å æéã®ãããå¦çããã¦ãéã1ç§ããã«ããªãªãã表示ãããã¨ããã³ã¼ãã§ãã # -*- coding: cp932 -*- import sys, time, â¦
ã¯ã¦ãªæ¥è¨ãã¼ã¯ã¼ãã®èªåãªã³ã¯ã£ã¦ãã©ãããã¢ã«ã´ãªãºã ã§ãã£ã¦ããã ããï¼ã¨æãã°ã°ã£ã¦è¦ãã¨ããããã®ãã®ãã°ããªãã¼ã¸ãè¦ã¤ãã¾ããã ã¯ã¦ãªãã¤ã¢ãªã¼ãã¼ã¯ã¼ãèªåãªã³ã¯API http://d.hatena.ne.jp/hatenadiary/20040205/1075960162 ãªâ¦
CodeSnippetsã®Pythonã«ãã´ãªãã¼ã¼ã£ã¨çºãã¦ããé¢ç½ãæ¸ãæ¹ãè¦ã¤ãã¾ããã http://www.bigbold.com/snippets/tag/python/ãããªã¹ãã®éé ãå¾ããæããµã¤ããããªæã㧠>> a = [1, 2, 3, 4, 5, 6] >> a.reverse() >> print a [6, 5, 4, 3, 2, 1] â¦
ã¬ã³ã¿ã«ãµã¼ãã¼ã®XREAã§ã¯ãCGIç°å¢ã§Pythonãåãã¾ããããã§å æ¥ä½ã£ãã³ã¬(âperlã§æ¸ãã)ã試ãã«Pythonã®web frameworkã§ããweb.py使ã£ã¦ä½ãç´ãã¦ã¿ã¾ãããã§ãä½ãªç´ãã奴ã¯ã³ã¬ã XREAï¼web.pyã§éã¶æé web.py http://webpy.org/ ãããwebâ¦
ãããªä¾¿å©ãªç©ããã£ãã¨ãã»ã»ã»ã» python24/Tools/Scriptsã«ãã£ããpythonã§ã¯tagã使ããªããã ã¨ã°ããæã£ã¦ãã æ©éãã¹ã®éã£ãã¨ããã«ããã¦.emacsã«ä»¥ä¸ã追å ã ;; ã¿ã°ãã¡ã¤ã«ã®èªåçæ (defadvice find-tag (before c-tag-file activate) â¦
pythonã®unittestã®ããæ¹ãããå¿ããã®ã§ã¡ã¢ï¼ã¾ã¨ãã ãã¹ãã±ã¼ã¹ãä½ã import HogeModule # ãã¹ã対象ã®ã¢ã¸ã¥ã¼ã« import unittest class testHogeModule(unittest.TestCase): # HogeModuleãã¹ãã±ã¼ã¹ def test_foo(self): # fooé¢æ°ã®ãã¹ãã¡â¦
http://d.hatena.ne.jp/alcoholgypsy/20060613 web.pyã«ãã®ãã®ãã°ããªã³ã¼ããããã¾ãããã 以ä¸ãweb.pyããã³ããã class Storage(dict): """ A Storage object is like a dictionary except `obj.foo` can be used instead of `obj['foo']`. Createâ¦
tokenizeã¢ã¸ã¥ã¼ã«ã使ã£ã¦pythonçµã¿è¾¼ã¿é¢æ°ã«è²ãã¤ãã¦ã¿ã¾ããã - colorizesource.py import sys import keyword import token, tokenize filename = sys.argv[0] if len(sys.argv) > 1: filename = sys.argv[1] token_colors = { token.NUMBER: '#00â¦
Pythonã§VideoCaptureãåºæ¥ãã¨ç¥ã£ãã®ã§éãã§ã¿ã¾ããã http://videocapture.sourceforge.net/ ã½ã¼ã¹ import VideoCapture import Image from ImageFilter import * import pygame from pygame.locals import * class ContourCamera: res = (320, 240)â¦
http://www.stani.be/python/spe/ Stani's Python Editorãç¥ãã¦SPEãããã¯ãªããªã便å©ãããPythonç¨ã®ã¨ãã£ã¿ã§ãã ã¤ã³ã¹ãã¼ã« http://www.stani.be/python/spe/page_download http://www.wxpython.org/ ä¸ãããã¦ã³ãã¼ããã¦ã¤ã³ã¹ãã¼ã«ããã â¦
Perl Monger ã®è³ªå - AUTOLOADã£ã¦ä»ã§ã©ãããã®? http://blog.livedoor.jp/dankogai/archives/50491359.html Pythonçãã¾ã ãã¨ãããã¨ãªã®ã§æ¸ãã¦ã¿ã¾ããããããªãããã class UnicodeChar: def __getattr__(self, attr): attr = attr.replace("u"â¦
ãªãã ãç¾å®éé¿ãã¿ããªã®ã§ãããã§ã¿ã¾ããã import random def one_over_fnoise(): t = random.random() # initial value while True: if 0 < t < 0.5: tt = t + 2 * t**2 elif 0.5 <= t < 1: tt = t - 2 * (1 - t)**2 else: assert False yield tt t â¦
ãããPythonã¯å³æ ¼ã§ãããã¨ããã®ãç®ã«ãããã§ãèªåã¯Pyhonãå³æ ¼ã¨æã£ããã¨ããªãããªãã§ã ãï¼ã¨çåã«æã£ãã®ã§ãPythonã¯ä»ã®è¨èªã«æ¯ã¹ã¦ã³ã¼ãã£ã³ã°è¦ç´ãå³æ ¼ãªã®ãï¼ã¨æ³åãã¦ã¿ããã§ãä»ã®TMTOWTDIã¨ããããLightweightãªè¨èªã ã£ã¦â¦
å æ¥æ¸ããMTæ稿ã¹ã¯ãªãããã»ãã¨ã¯Livedoorããã°ã§ä½¿ãããã£ããã ãã©ãªãã ãlivedoorã§xml-rpcã¯ã¤ãããªãã£ã½ããããä»ï¼ã¯AtomAPIã¨ããã®ã使ããªãã¨ãããªãããã ãç¥ããªãã£ãorzã§ãAtomAPIã«ã¤ãã¦ã¯ããã¯ã¦ãªããã¯ãã¼ã¯AtomAPIãã¨â¦
Pythonã§MovableTypeã«æ稿ããã¹ã¯ãªããããã #!usr/bin/python import xmlrpclib def publish_entry(title, text): server_url = 'http://example.com/mt/mt-xmlrpc.cgi' blog_id = '1' username = 'hogeee' password = '******' server = xmlrpclib.Serâ¦
Pythonã«ãBase64ã¢ã¸ã¥ã¼ã«ãããããããªæãã >>> import base64 >>> base64.b64encode('rocky') 'cm9ja3k=' >>> base64.b64decode('cm9ja3k=') 'rocky' >>> ãæ軽ã ãªãããã
ãã©ã«ãã®ä¸ã®éè¤ãã¡ã¤ã«ããã§ãã¯ããããªã¼ã¨æã£ã¦ãã¡ããã£ã¨æ¸ãã¦ã¿ãã # -*- coding: cp932 -*- # md5checker.py import sys, os, re, md5 path = sys.argv[1] pat = re.compile(".(" + "|".join(sys.argv[2:]) + ")$") d = os.listdir(path) fâ¦
MeCabï¼å½¢æ ç´ è§£æãã¿ã®ç¶ãã§ãPythonã§ç°¡æãã¤ã¸ã¢ã³ãã£ã«ã¿ä½ã£ã¦ã¿ã¾ããããã¤ã¸ã¢ã³ãã£ã«ã¿ã£ã¦ä½ããï¼ã¨ããæ¹ã«ç°¡åã«èª¬æããã¨ãããã¹ãåé¡ããã°ã©ã ã®ãã¨ã§ããããããå©ç¨æ¹æ³ã¨ãã¦ãããã¡ã¼ã«ããã¹ãã ã¡ã¼ã«ãããã§ãªãã®ãã®å¤â¦
IPythonããrunããã®ã¨æ®éã®Pythonã§ã¹ã¯ãªããåããã®ã¨ã§ã¯æåãéãããããã¼ããã¼ãã©ããããããã ãã - ãã¼ããã£ãï¼ãªãã closeããªãããããªãã®ãã
http://ipython.scipy.org/screenshots/index.html ããã¯ããããï¼ï¼ï¼è¶ 便å©ããï¼ï¼ï¼Pythonã·ã§ã«ã®æ代ãæ¥ããããããªããããã»ãã¨ã«ã - å°å ¥ã«ããã£ã¦id:Wackyããã®ãã¼ã¸ãåèã«ãã¾ããããããã¨ããããã¾ããã http://d.hatena.ne.jp/Wâ¦
Pythonã§ãã£ã¦ã¿ãã 課é¡ï¼ æå®ãããã£ã¬ã¯ããªä»¥ä¸ã®ç©ºãã£ã¬ã¯ããªãå ¨ã¦åé¤ããªãã import os def remove_dir_empty(root): for name in os.listdir(root): path = os.path.join(root, name) if os.path.isdir(path): remove_dir_empty(path) # åâ¦
å½¢æ ç´ è§£æã§ä½ãããããããã¿ã¯ãªããã¨æ¢ãã¦ããã¨ããã以ä¸ã®ãã¼ã¸ãè¦ã¤ãã¾ããã TF-IDFã¨æ¤ç´¢APIã§ãã¼ã¯ã¼ãæ½åº http://nais.to/~yto/clog/2005-10-12-1.htmlãã¼ã¯ã¼ãæ½åºã¢ã«ã´ãªãºã ã®TF-IDFã¯ãã³ã¼ãã¹ã¨ããè¾æ¸ãã¡ã¤ã«ãå¿ è¦ã§è©¦ãã¦â¦