python
Python2.5以éã§ãwithã¹ãã¼ãã¡ã³ãã使ããã with open('logfile', 'r') as logfile: logfile.write('hogehoge') ããããã¨ãopen()ã§éãããã¡ã¤ã«ã®close()ãæé»çã«ã確å®ã«å¼ãã§ããããwithãªãã ã¨ããããªãµãã«ãªã£ã¦ãã¡ãã£ã¨è¦è¦ããã lâ¦
ä»åã®ã¤ãã³ãã§ã¯ããªã³ã©ã¤ã³KPTãã¨ç§°ãã¦ã主ã«æºå¸¯ããããã¾ã®ããã£ãï¼ãã¨ããææãå ¥åã§ããã·ã¹ãã ãç¨æãã¾ããããã¤ãè²¼ãç©ã»ã¢ããã°ã人æ°ãªã®ã§ããããã試ã¿ãã©ãåãæ¢ãããããå¿é ã ã£ãã®ã§ãããäºæ³ä»¥ä¸ã«ã¿ãªãããåãã§â¦
Windowsç°å¢ã®è©±ã mercurial.iniã« [ui]ignore=c:\home\hgignore.ini ã¿ããã«æ¸ãã hgignore.iniãã¡ã¤ã«ãä½ãã mercurial.ini: [ui] username=yattom editor="C:\Program Files\Vim\vim71\gvim.exe" ignore=c:\home\hgignore.ini hgignore.ini: syntaxâ¦
ã¯ã©ã¹å®ç¾©ã§ãã¤ã³ã¹ã¿ã³ã¹ã«èªç±ã«å¤æ°ã追å ã§ããªãããã«ã¯ã__slots__ãæå®ããã使ããå¤æ°åããªã¹ãã§æ¸¡ãã >>> class Foo(object): ... __slots__ = ['foo'] ... >>> f = Foo() >>> f.foo = 10 >>> f.bar = 20 Traceback (most recent call lastâ¦
ãã¾ããã§ããã1.0ãåºããã¨ã ããMercurialå ¥ãã¾ãããããã¸ã§ã¯ãã§ã¯Subversion使ã£ã¦ããã©ãå人ã¬ãã«ã®ä½æ¥ã§å±¥æ´ãåãããã«ã Windowsç¨ãã¤ããªããã¦ã³ãã¼ã http://mercurial.berkwood.com/ ã¤ã³ã¹ãã¼ã©ã§ã¤ã³ã¹ãã¼ã«ãPATHã«ã¯èªåã§â¦
difflib(2.1以é)ã®HtmlDiff(2.4以é)ã使ãã¨ã2ã¤ã®ããã¹ãã®å·®åãåå¾ãã¦ãHTMLã§ç°¡åã«åºåã§ãããè¡åä½ã ãã§ãªããæååä½ã®å·®åãæ示ãã¦ãããã®ã§ä¾¿å©ãwithã¹ãã¼ãã¡ã³ã(2.5以é)ã使ãã¨ããããªæãã from __future__ import with_staâ¦
Python Imaging Library (PIL)ã試ãã¦ã¿ãããªãµã¤ãºã¨ãããããç°¡åãeasy_install pil ã§å ¥ãã import Image im = Image.open("foo.jpg") new_im = im.resize((1024, 768), Image.BICUBIC) new_im.save("foo2.jpg") (2008.3.18追è¨)ãã¨ãã°rorateã¯åâ¦
codecs.open ã使ãã®ãç°¡åã3çªç®ã®ãã©ã¡ã¼ã¿ã§ã¨ã³ã³ã¼ãã£ã³ã°ãæå®ããã from codecs import open in_file = open("before.txt", "r", "iso-2022-jp") out_file = open("after.txt", "w", "utf-8") for l in in_file: out_file.write(l) in_file.cloâ¦
Trac Hacksã«ç»é²ããã¦ãããã©ã°ã¤ã³ããã¯ããããã»ããµãªã©ã«ãæ¥æ¬èªã§ã²ã¨ãã¨èª¬æãã¤ããä¸è¦§ã§ããåºæ¬çã«Trac-Hacksä¸ã®èª¬æãèªãã§æ¸ãã¦ããã®ã§ãå®éã«åããã¦ãã¾ããããåéããããã¨æãã¾ãããã¨ãã¨10æãããããã¡ããã¡ããä½â¦
http://www.python.jp/Zope/PyLog/1201102994ä¸ã§ãï¼ãããã¯ãã¨ã¨ãã®ç§ã®DevCampã«åå ãããã§ããããã®ã¨ãã¯3æ¥éPython漬ãã§ã¨ã¦ãæ¿ãã¦ç±ãä½é¨ããã¦ãã¾ãããhttp://d.hatena.ne.jp/yach/20061003ä»åã¯å½¹ã«ç«ããªãã¹ã¿ããã¨ãã¦åå ããäºâ¦
ãã¯ãã¯æ¸ãããã¨ããããã©ãã©ã°ã¤ã³ãã¡ããã¨ä½ãã«ã¯eggã«ããªãã¨ãããªãããã®ã¸ãã®ãã¨ã http://trac.edgewall.org/wiki/TracDev/PluginDevelopment http://trac-hacks.org/wiki/EggCookingTutorial/BasicEggCooking API http://trac.edgewall.â¦
äºæ ããã£ã¦ãtrac0.11devã¨trac0.10ã並è¡ç¨¼åããããã¨ã«ãèãã¦ã¿ãããããããã¨é¢åããããã ã tracãã¤ã³ã¹ãã¼ã«ããã¨lib/python2.4/site-packagesã«å ¥ãããã¡ãã¯ãã¼ã¸ã§ã³ç®¡çããã¦ãã®ã ãã©ãå®è¡ç¨ã®ã¹ã¯ãªãã(tracd, trac-admin)ã¯bâ¦
ç¶ãã tracã§svnã使ããªã æ¨æ¥ã¾ã§ä½¿ãã¦ãã®ã«ã使ããªãã¨è¨ããã Pythonãmakeããªãããã®ãåå ããã subversion ã make install-swig-py ããªããããç´ã£ã ãããããªãã£ã½ã apache ã®åèµ·åãå¿ è¦ åèµ·åæã«ã以ä¸ã®ã©ã¡ããã§ãªãã¨ã ãâ¦
ç¶ãã vim aapããå ¥ãããhttp://www.a-a-p.org/ports.html http://www.a-a-p.org/download.html ./configure --disable-darwin --enable-pythoninterp --enable-rubyinterp --disable-netbeans --enable-multibyte --enable-nls multi_byte, gettext ãã¤â¦
YAMLã£ã¦ä¾¿å©ã§ããããã§ãå®ã¯ãPythonã«ã¯è¨èªä»æ§ã¬ãã«ã§ãåçã®æ©è½ããããconfig.py: PREFIX='>>' DELIMITER='----' class ACCOUNT: id = 'username' pwd = 'password' class DETAIL: name = 'J.Luser' email = '[email protected]'main.py: importâ¦
http://d.hatena.ne.jp/yach/20070905 ã®ç¶ãããã£ããã¡ãã»ã¼ã¸ã®åä¿¡ã¨ãã¯ãã¤ãã³ãã§å¦çãããã¤ãã³ãã¯ã_ISkypeEvents (https://developer.skype.com/Docs/Skype4COMLib/ISkypeEvents) ã§å®ç¾©ããã¦ãããwin32com ã§COMã¤ãã³ããæ±ãã«ã¯ã以ä¸â¦
Python Extension for Windows (pywin32; http://sourceforge.net/projects/pywin32/) 㨠Skype4COM (https://developer.skype.com/Download) ã使ãã¨ç°¡åã«SkypeãPythonããæä½ã§ããããã£ã¨ãå½ç¶ã§ãã Windows ã®è©±ãã¯ãã¹ãã©ãããã©ã¼ã ã«ãããªâ¦
tracç¨ã®ãã³ã«ã¬ãã¯ããæ¸ãã¾ããã以ä¸ãããã¦ã³ãã¼ãã§ãã¾ããNikoCaleMacro â Trac Hacks - Plugins Macros etc.ãã³ã«ã¬ã«ã¤ãã¦ã¯http://www.geocities.jp/nikonikocalendar/index_ja.htmlãã©ããã ã¤ã³ã¹ãã¼ã«: .zip ãã¡ã¤ã«ããã¦ã³ãã¼ã â¦
6/30ã®Python Workshop the Edge 2007ã«åå ãã¦ãã¾ããã楽ããã£ãã§ããã¼ãã§ãææ³ã¯ã¨ãããã¨ãã¦ãã©ã¤ããã³ã°ãã¼ã¯ã¹ããã£ãã®ã§ãããæ¥é½é£ã³å ¥ãã§ãã¼ã¯ã¹ãããã¦ããã ãã¾ãããããããã¼ã«ã¼ã®æ¸å·ããã«ããããã¦ã話ããããã¿ããâ¦
(ã¯ã©ã¹ã¤ã³ã¹ã¿ã³ã¹ã«ã¡ã½ãããåçã«è¿½å ããæ¹æ³ã«ã¤ãã¦ãã¯ã©ã¹ã«å¯¾ãã¦ã¡ã½ãããåçã«è¿½å ããã®ã¯ç°¡åãã¤èªæã ãã©ãã¤ã³ã¹ã¿ã³ã¹ã«è¿½å ããã®ã¯ã²ã¨ã²ããå¿ è¦ã§ãã)Pythonã®ã¯ã©ã¹ã¤ã³ã¹ã¿ã³ã¹ã«ã¯èªç±ã«ã¢ããªãã¥ã¼ãã追å ã§ããããã¼ã¿â¦
ãªãã¸ã§ã¯ãå¶æ¥½é¨ç§ã®ã¤ãã³ããã11/17(é)ã®å¤ã«ããã¾ããå®ã¯ããç³ãè¾¼ã¿ãç· ãåã£ã¦ãã¾ã£ãã®ã§ãããææ¥2æ¥(æ¨)ã®æ£åããã追å ã§10åã ã追å ç³ãè¾¼ã¿ãåãä»ãããã¨ã«ãªãã¾ãããä»åã100人弱ããå ¥ããªãå ´æããç¨æã§ãããã¨ã¦ãæ®å¿µâ¦
æ¨æ¥ç¬¬ï¼åãããã¾ãããåå è ã¯5åã http://qwik.jp/minpyshakyo/5.htmlPythonåå¿è ãå¤ãã¦ããªããªãããæãã§ããæ¬èªä½ãããPythonå ¥éãã®ã¿ãªãããããã°ã©ãã³ã°å ¥éãã«è¿ãã®ãã幸ããã¦ãããªã第2å以éããã®åå ãæè¿ã§ãã次åã¯10/â¦
Or maybe you can use $ easy_install -m TurboGears to remove old version, and use $ easy_install -U TurboGears to force install new version
ã¨ããããã§3æ¥éPython漬ãã«ãªã£ã¦ãã¾ãããããã¨é»ã ã¨ããã°ã©ãã³ã°ãã¦ããæéãå¤ãã£ãã§ãããã£ã¨ä»ã®äººã¨ããã¹ãã°ããã£ãããã Webã¢ããªã¹ããªã³ã Webãã£ããã¯ããã¡ããéåæã§(ãã¼ãªã³ã°ããã«)åãããã«ãªã£ããã®ã®ãåæ¥ç¶ãâ¦
ææ¥ããå¯å£«ã§ãããªãããPython DevCamp 2006ã«è¡ã£ã¦ãã¾ããæ³ãããã§ã³ã¼ãã£ã³ã°(ï¼ããã¥ã¡ã³ã)ããã¾ãã¨ãããã¨ã§ãã¨ã¦ã楽ãã¿ãhttp://nagosui.org/Nagosui/Misc/temporary-items/events/devcamp2006sããã§ãããã¤ããã©ãã¯ã¨è¨ããã³ã¼â¦
ãã¦ããã®ä»çµã¿ã¯ã©ããã£ã¦å®ç¾ããã¦ãããã¨ããã¨ãturbogears/widgets/forms.py ã® CompoundInputWidget.params_for(self, item, **params)ã§å®è£ ããã¦ããããã®ã¡ã½ããèªä½ã¯TableFormã®ãã³ãã¬ã¼ãããå¼ã³åºãããããããªæãã«ãªã£ã¦ãã(æâ¦
Widgetsã®TableFormã¯ãè¤æ°ã®Widgetãè©°ãè¾¼ãã§ãã©ã¼ã ã«ã§ãããè©°ãè¾¼ãã®ã¯ãã¡ããINPUTè¦ç´ ã«ãªããããªWidgetã§ããã¨ãã°ä»¥ä¸ã®ããã«æ¸ããã(æ¸ãã¦ãæ¬ããã®æç²) from turbogears import widgets class EditUserWidgets(widgets.WidgetsList)â¦
time.strptime(string, format)ã使ãã http://www.python.jp/doc/release/lib/module-time.htmlstrftimeã¯datetimeã¢ã¸ã¥ã¼ã«ã®åã¯ã©ã¹ã«ããã®ã ãã©ãstrptimeã¯timeã¢ã¸ã¥ã¼ã«ã«ãããªãã®ã§æ³¨æã æ¥ä»ã®ãã¼ã¹ã¯ããããªæãã楽ãããã y,m,d,_,_,â¦
Pythonã®ã©ã¤ãã©ãªã®ãªãã¸ããªã¨ãã³ã¼ãã«ã¿ãã°ã¨ãã¤ãã£ãªã ã¿ããã®ã£ã¦ã©ãã«ãããã§ããããï¼ã¨æã£ãã®ã§æ´çãã¦ã¿ã¾ããã PyPI â the Python Package Index · PyPI python.orgã®ä¸ã«ãããããããªããã±ã¼ã¸ã®ãªãã¸ããªãæåã©ããã¨ããâ¦
ç¾è¡ã®é²ã¿å ·åãè¨é²ããããã«ä½æãã¾ãããWindowsã®ã¿ã¹ã¯(ã£ã¦ãããã«ããååã ããªããã¿ã¹ã¯å®æå®è¡ã®æ©è½ã®ãã¨ã§ã)ã使ã£ã¦ã1æéããã«è¨é²ããããã«ãã¦ãã¾ãããã¡ã¤ã«ã大ãããªãã°ãã¾ãä»äºãé²ãã§ããããªãã¨ã import sys imporâ¦