2008-03-01ãã1ã¶æéã®è¨äºä¸è¦§
PythonRecipe 185:ç´è¡åº§æ¨ã極座æ¨ã«å¤æãã ãæ¸ãã¦ãã¦æã£ããã¨ãRuby ã®è¤ç´ æ°ãã㯠Complex#abs ã§çµ¶å¯¾å¤ãComplex#arg ã§åè§ã Complex#polar ã§ä¸¡æ¹ãå¾ããã¨ãã§ãããã¨ãç¥ã£ãã irb(main):001:0> require 'complex' => true irb(main):00â¦
ããã°ä¸é±éæ¾ç½®ãã¦ãã¾ã£ããããã°ã®ç¶ç¶ã¨å®çæ´»ã®å å®ã両ç«ããªãâ¦ãããã°æ¦ï¼æã®ãªã¬ã«ã¯ãã¼ã¹ã®é åãé£ããããã§ããããã§ä»äºã¯é 調ãé¨å±çä»ãå®äºããµã¤ã¯ãªã³ã°ã«ãããã¤ã¨ããç¶ç¶ãã®ä»ããããã§ãããã©ã
050:æååããã¤ããã¨ã«å¦çããã072:æååãè¤æ°ã®æ£è¦è¡¨ç¾ã®ãã¹ã¦ã«ãããããã調ã¹ãã138:ãã¡ã¤ã«ãèªã¿æ¸ãå¯è½ã調ã¹ãã019:é©åãªæååãªãã©ã«ãé¸ã¶ã®ï¼ä»¶ã§ããã è¿½è¨ 23:07 å¯ãåã«ï¼ä»¶è¿½å ã§ãã¾ããã167:ãã¡ã¤ã«ã®å é ã®nè¡ãåé¤â¦
PythonRecipe æ稿ã044:ç¹å®ã®æåãå«ãé¨åã®é·ãã調ã¹ã 㨠071:æ£è¦è¡¨ç¾ã®ã¡ã¿æåãã¨ã¹ã±ã¼ããã ãå¯ã¦èµ·ããã 14 æã§ããããã¨ãã£ããã ã£ãæ¥ææ¥ã 12 æéããã¦ã³ããã£ã¦ã©ããããã¨ã ãªã¬ï¼ ä¼æ¥ã«ããããããæ稿ããã¬ã·ãï¼ã¤ã®å â¦
PythonRecipe æ稿ãoptparse ã¢ã¸ã¥ã¼ã«ããããã使ã£ã¦ã¿ããã¨æãç«ã£ã人åãã¨ãã¦ã207:ã³ãã³ãã©ã¤ã³ãªãã·ã§ã³ã解æãã ãã¢ãããã¾ããã ã¤ãã§ã« 206:ã³ãã³ãã©ã¤ã³ãªãã·ã§ã³ãå¾ã ãã¢ãããæ¡ã®å®ãåå°½ãã¾ããã OpenOffice calc + â¦
PythonRecipe ã« optparse ã¢ã¸ã¥ã¼ã«ã®ãã¨ãä¸ãããã¨æç« ãç·´ã£ã¦ããããã¾ã éä¸ãªã®ã«ãã¬ã¼ã³ããã¹ã㧠16KB è¶ãã 450è¡è¶ ããã®ã¾ã¾ããã¨ãªãã¡ã¬ã³ã¹ããã¥ã¢ã«ã®å£åã³ãã¼ã«ãªããããªããå¿ è¦ãªãã¨ã¯èªè 層ãæèãããã¨ã Python ã«å¤¢ä¸â¦
èªæã®æã¨ãã¦ãå»å¹´ã®ä»äºå ´ã§ã®èªåã天çã«ãªã£ã¦ããã¨ããããã£ããªãã¨ãããããã客観çã«è¦ã¦ããªã¬ãã³ã³ãã¥ã¼ã¿ã¼ã¶ãåãåã¯ä»ããè·å ´ã®äººéããé«ããããã©ããã®è·å ´ã®ã¬ãã«ã¨ããã foobar åé¡ãã解ããªãã¦è©¦é¨è¡¨ã«ãã«ããã¤ãã¦â¦
å·¡å - 常山æ¥è¨ ããããâ¦ãåæåã¾ã§ãããã®æç« ã¯èªãã ãèªãã§ãããã«æ¸ããã¨ãä¸åãã¦ãªãã£ããªã¬ãªãããè¼ã£ã¦ãããããã¨ããããã¾ããï¼ã¶æã¯ç¡åå¿ãè¦æã§ã¯ããã¦ãã®ã§ãããäºæ³å¤ã®å·¡åãããã¯ããæ°åºã¾ãã
ä»æ¥ããã¼ã¸ã£ã¼ã¨è©±ãæ©ä¼ãã§ãã¦ã誤解ãã¨ãããã¹ã¯ãªããè¨èªã®ä»¶ãåãæ¶ãããã®è¨èªã§ã®æ¡ä»¶ããããã©ããã¨ããç¹ã«çµã£ã¦ã®è©±ã ã£ãããããã«ãéã«ãªããªã以ä¸ãå½¼ã«ã¨ã£ã¦åå¨ããªãã¨å義ã大ç®ã«è¦ã¦ã趣å³ã®åãåºãªããã§ãåæãããªâ¦
API ãªãã¡ã¬ã³ã¹ã®ç´èªã¿ã ã¨æ½è±¡çããã¦ã Basic ã®ä¾ã ã¨å ·ä½çããããJava ã®ä¾ã調ã¹ãã¹ããããã¯â¦ããã ãã¾ ã¦ã£ãªã¢ã ã®ããããã®éçºæ¥è¨ ãªã©ãèªãã§ãã¾ãããã¨ã¯ã str ã repr é¢æ°ã«å種ãªãã¸ã§ã¯ãããããã¨ããã®ãªãã¸ã§ã¯ããã©â¦
è³æä¸è¶³ãAPI ãªãã¡ã¬ã³ã¹ ãã¿ã¤ãã£ãã®ã§ãæ¥ãã°åããã®ç²¾ç¥ã§ããããããããããã¯ããã©ããæ¨æ¥ OpenOffice.org Scripting with Pythonãåèã«æ¸ããã³ã¼ãã®ä¸é¨ãcalc ã®ã·ã¼ãåå¾ããã®è£ã§ãªã«ãèµ·ãã£ã¦ããã®ã API ãªãã¡ã¬ã³ã¹ã¨ããâ¦
ãããã㤠OOoBasic ãã¯ãã Python ã«ç¿»è¨³ããã³ããããã£ã¦ãããã»ã¨ãã©ãã®ã¾ã¾ã ãã©ç´ããªãããããªãã¨ããã¯ãã£ã±ããã£ã¦ã StarDesktop 㯠XSCRIPTCONTEXT.getDesktop() ã ã£ãã Array ã¯ã¿ãã«ã ã£ããã struct 㯠uno.createUnoStruct("â¦
OpenOffice calcãpythonã§åãããããã© â lights on zope ã¸ã®ææ¦éå§ãã¡ãã£ã¨èå³ããã¦ãããã¾ã ããããã£ã¦ãªãããã©ããªãã¨ãã»ã«ã®å¤ãèªãã¨ããã¾ã§ã§ããããã®å 容㮠py ãã¡ã¤ã«ï¼UTF-8, æ¹è¡æåLFï¼ã C:\Documents and Settings\ã¦ã¼â¦
OpenOffice calcãpythonã§åãããããã© â lights on zope ã® seko ããã¸ã Python-Uno ãªããã®ãè¦ã¤ãã¾ãããæ¥æ¬èªã®èª¬æã¨ãµã³ãã«ã³ã¼ãã¯OpenOffice.org Scripting with Python ãåèã«ãªãããã§ããã¨ã¯ãããã¡ããã¾ã OpenOffice ãã¤ã³ã¹â¦
ä»æ¥ã® PythonRecipe ã¯127:ã¹ã¿ãã¯ããã¥ã¼ã使ã ãå¹³æ¥ã¯æ軽ãªãã®ä¸å¿ã§ããã¦ãææ¥ã¯éæããããã¨ã¯çµããããããªãã¬ã·ãã«æãã¤ãããã¨ãããé¢ç½ãããªã®ã¯ã206:ã³ãã³ãã©ã¤ã³ãªãã·ã§ã³ãå¾ãããã207:ã³ãã³ãã©ã¤ã³ãªãã·ã§ã³ã解æãâ¦
ä»æ¥ãPythonRecipe ã«æ¸ãã182:æå¤§å ¬ç´æ°ã¨æå°å ¬åæ°ãæ±ãã ãããæå¤§å ¬ç´æ°ãã¦ã¼ã¯ãªããã®äºé¤æ³ã«ã¦ç®åºããé¢æ°ãéå帰çããã®æå¾ã®é¨å x, y = y, x % y ãæ£ããåãã¦ããã幸ãã def _gcd(x, y): u""" æå¤§å ¬ç´æ°ãæ±ãããåãã§ãã¯ç¡â¦
æ¨æ¥è²·ã£ãæ¬ 3 åã並ã¹ã¦ã¿ãã ã¦ã§ãæ代 5ã¤ã®å®çâãã®è¨èãæªæ¥ãåãéã! FFmpegã§ä½ãåç»å ±æãµã¤ã ã²ã ã¾ãã¹ã±ãã (3) (ã¾ããã¿ã¤ã KRã³ããã¯ã¹) ãªããªãã ãã®çµã¿åããã¯ï¼ã²ã ã¾ãï¼å·»å³èªäºããªã¬çã«èªã¾ãã«ã¯ããããªãã»ã®ã¼ã®â¦
ClientCookie ã®ããã¥ã¡ã³ãã«ãããã£ããæ¸ãã¦ããããã©ã¡ã¢ãIE ã®ã¯ããã¼ãèªã¿åãã«ã¯ ClientCookie.MSIECookieJar ã¤ã³ã¹ã¿ã³ã¹ãä½ã£ã¦ load_from_registry() ãå¼ã¶ã import ClientCookie ie_cookie_jar = ClientCookie.MSIECookieJar() ie_coâ¦
PythonRecipe ã® 163 çªç®ç¨ã«èãã¦ããæä¸ãã¤æªãã¹ãã®ã³ã¼ããRuby ã¬ã·ãããã¯ã¨åãããä¸æãã¡ã¤ã«ã使ç¨ãããã®ã import tempfile import os import stat def _rename(f1, f2): if os.name == 'nt': os.remove(f2) os.rename(f1, f2) else: osâ¦
http://d.hatena.ne.jp/mssh/20080308#1204974183 ãèªãã§ãªã¹ãå å 表è¨ã«è¦æ¦ãã¦ããé ãæãåºããã®ã§ãfor æ if æãããããå ¥ã£ã¦ï¼è¡ã«æ¸ããããªã¹ãå å 表è¨ããã ã® for æã if æã¨ãªã«ãå¤ãããªããã¨ã«æ°ã¥ãã¦ããã¹ã ã¼ãºã«èªããããâ¦
PythonRecipe ã« 163:ãã¡ã¤ã«ã«ä¸è¡æ¿å ¥ãã ã¨ãã¦æ¸ãã¦ãã¾ãããããã¯ããããã¨ããããæ¸ãã¹ãã¨ããã¢ã¤ãã£ã¢ãããæ¹ãã©ããæ¸ãæãã¦ãã¾ã£ã¦ãã ããããããããé¡ããã¾ãã import tempfile import os import stat def _rename(f1, f2): â¦
ããã°ã¿ã¤ãã«å½åããéæã®ç¬¦å·ãã§ãâ¦ããã¶ãçãããªä¸äºççã¿ã¤ãã«ã«ãªãã¾ãããï¼ã ã§ã好ããªãã®ã¯å¥½ããªã®ã§ãããããªããããã§ããã¾ãã以ä¸çµç·¯ã ã¾ããä»ã¯å»å¢ã®èªãµã¤ããããæãããã£ã¦ããããæ æ°æè¨ãããããããªãï¼ã¶æã«â¦
os.name == 'nt' ã¤ã¾ã Windows ã® cmd.exe 㧠Python ã¹ã¯ãªããã«å¼æ°ãä¸ããã¨ãã®è©±ã UNIX ã·ã§ã«ã¨éã£ã¦ä½ããã¦ãããªãï¼ããããï¼ã®ã«ã¡ãã£ã¨ããæããè¦ãã¦ã¿ãããæ®æ®µã¯æ°ã«ãªããªãã®ã«ä»æ¥ã¯ãªã«ãå¤ã ã *.py ãããèéå©ããã¦ã»ãâ¦
æ¥è¨ã¿ã¤ãã«æ±ºã¾ããªããããããªãä¸æ¥æ®ãç½®ãã
æ°·æ²³æã®çå¹éªã«ãºãããã«å¼ãè£ããã人ã ã¨ãã°ã³ã°ã³æé·ãã人ãã¡ - åè£åéãååå ´ by ãµããã ãæãã¦ï¼ãã³ã³ã¼ã¬ã¤ï¼ãã¨ããå¬éåªæã¯ãèªåããããã§ã«ãªããã人ããã©ããã£ãããããã§ã«ãªããã®ããæãã¦æ¬²ããã¨ãã ãã«ããå±ãâ¦
æ¸ãå§ãã¦ï¼æ¥ç®ãç¾ã¿ã¤ãã«ãã·ã¥ã³æ¥è¨ï¼ä»®ï¼ãããããã«ã·ã¥ã³ã®æ¥è¨ãªããã§ããªãæ£ããååã§ã¯ãããã©ããã«æ£ç¢ºæ§ãã¨ãã¦ã©ãããããã¨ãæ£å¼åä»æ©ã¾ã§ã«æ±ºãããããããã éªç½ä¸é ã®ãããªè¨èéã³åå¸æãéã«ãµããã¦ã¿ãï¼ ãããããâ¦
PythonRecipe ã«æ¸ãè¾¼ã¿å§ãã¦ï¼é±éããããèªåãæ¸ãããã¿ã¤ãã£ã¦èªåãæ¸ããããã¹ãéã確èªãã¦ã¿ããã¨ã«ãã¦ã¿ããã²ã©ãèªå·±æºè¶³ã ãè¨äºã¯ recipe018_äºç´èª.txt ã®ãããªãã¡ã¤ã«ã«æ¸ãæºãã¦ãããæ£è¦è¡¨ç¾ã 㨠recipe\d{3}_.+?\.txt ããã®â¦
ããã°ã¯ããã¦ã¿ããï¼æ¥å主ã«ãªãã¬ãããã§ãã¯ãããããã¦çãå°½ããªãããé©åº¦ãªãã¼ã¹ã§é²ãã¦ããããã¨ãããæã¯æ¥è¨æãã¦ãããã¨ããã£ãããã§ããªãã ãæãããããã¼ã¹ã ããã©ããã©ããããããªããã¨ãããªãã¨ãåæ¥ã¯æ¸ããã決ã¾ãâ¦