2008年01月22日 星期二 09:19
ºÇºÇ£¬Ã«Ëì×Ô¼öÒ»¸öС¹¤¾ß¡£ Python¾³£»á°Ñ½Å±¾×°ÔÚ%Python%\ScriptsÏÂÃ棬ºÜÄÑÓã¬Ö´ÐеÄʱºòÐèÒªÅܵ½Õâ¸öĿ¼ÏÂÈ¥¸ã Èç¹û£¬½Å±¾Ïñ¿ÉÖ´ÐгÌÐòÄÇÑù£¬*ÔÚϵͳµÄPATHÀïËæ±ãÕÒ¸öĿ¼һ·Å¾ÍÄܵ½´¦Ö´ÐÐ*¸Ã¶àºÃ£¡ Ô糿ÅÀÆðÀ´£¬Ð´Á˸ö¹¤¾ß£¬°üÀ¨Ò»¸öÅú´¦ÀíÎļþÒÔ¼°Ò»¸öpython½Å±¾¡£ *°²×°·½·¨*£º 1. ÏÂÔØhttp://www.2maomao.com/blog/wp-content/uploads/exepy.zip 2. ÔÚϵͳPATHÖÐÕÒ¸öĿ¼£¬ÍùÀïÒ»ÈÓ¾ÍÐУ¬ÎÒ·ÅÔÚÁËc:\python\scripts£¨ÒѾ¼ÓÈëϵͳPATHÖУ© *ʹÓ÷½·¨*£º ´Ë¹¤¾ßΪÃüÁîÐй¤¾ß ÔÚÃüÁîÐÐÖУ¬ÇÃÈ룺p epydoc xxx ÕâÑù¾Í¿ÉÒÔÖ´ÐÐc:\python\scripts\ÏÂÃæµÄepydoc.pyÁË£¬xxxÊDzÎÊýÁбí *×¢Òâ*£ºpython.exeËùÔÚĿ¼Ҫ¼ÓÈëµ½PATHÖУ¬Í¨³£ÊÇc:\python ¡ª¡ª¡ª¡ª-*ʵÏÖϸ½Ú*¡ª¡ª¡ª¡ª- Åú´¦ÀíÎļþp.bat£º ÏÂÔØ: p.bat<http://www.2maomao.com/blog/wp-content/plugins/coolcode/coolcode.php?p=451&download;=p.bat> @echo off REM this command file intend to quickly execute python file in the PATH REM Usage: p xxx, xxx is the name of xxx.py in PATH python %~dp0\py\exepy.py %1 %2 %4 %5 %6 %7 %8 %9 @echo on Python½Å±¾£¨·ÅÔÚp.batËùÔÚµÄĿ¼µÄ"py"×ÓĿ¼Ï£¬¿ÉÒÔ×Ô¼ºÈ¥ÐÞ¸Äp.batÀ´×Ô¶¨ÒåĿ¼£© #!/usr/bin/python import os import sys #----------------------------------------------- def show_help(): print print " Purpose: Execute python script in system PATH" print " Usage: p python_script_name [params]" print #----------------------------------------------- if len(sys.argv) < 2: show_help() exit() script = sys.argv[1] if len(script) > 3 and script[-3:].lower() != '.py': script += '.py' params = "" for arg in sys.argv[2:]: params += " \"" + arg + "\"" path_str = os.environ['PATH'] paths = path_str.split(';') for path in paths: if len(path) == 0: continue if path[-1] != '\\': path += '\\' full_path = path + script if os.path.isfile(full_path): cmd = "python \"" + full_path + "\"" + params os.system(cmd) exit() -- http://www.2maomao.com/blog -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20080122/7107828c/attachment.htm
2008年01月22日 星期二 10:30
只要修改两个环境变量就行了 1. PATH,把C:\python25\scripts加上(假设你的python2.5安装在c盘) 2.PATHEXT,添加扩展名.PY;.PYW 然后你就可随便执行你的python脚本了,就像EXE或BAT一样 在08-1-22,realfun <realfun在gmail.com> 写道: > > 呵呵,毛遂自荐一个小工具。 > > Python经常会把脚本装在%Python%\Scripts下面,很难用,执行的时候需要跑到这个目录下去搞 > > 如果,脚本像可执行程序那样,*在系统的PATH里随便找个目录一放就能到处执行*该多好! > > 早晨爬起来,写了个工具,包括一个批处理文件以及一个python脚本。 > *安装方法*: > 1. 下载http://www.2maomao.com/blog/wp-content/uploads/exepy.zip > 2. 在系统PATH中找个目录,往里一扔就行,我放在了c:\python\scripts(已经加入系统PATH中) > > *使用方法*: > 此工具为命令行工具 > 在命令行中,敲入:p epydoc xxx > 这样就可以执行c:\python\scripts\下面的epydoc.py了,xxx是参数列表 > > *注意*:python.exe所在目录要加入到PATH中,通常是c:\python > > ————-*实现细节*————- > 批处理文件p.bat: > 下载: p.bat<http://www.2maomao.com/blog/wp-content/plugins/coolcode/coolcode.php?p=451&download;=p.bat> > @echo off > REM this command file intend to quickly execute python file in the PATH > REM Usage: p xxx, xxx is the name of xxx.py in PATH > python %~dp0\py\exepy.py %1 %2 %4 %5 %6 %7 %8 %9 > @echo on > > Python脚本(放在p.bat所在的目录的"py"子目录下,可以自己去修改p.bat来自定义目录) > #!/usr/bin/python > import os > import sys > #----------------------------------------------- > def show_help(): > print > print " Purpose: Execute python script in system PATH" > print " Usage: p python_script_name [params] " > print > #----------------------------------------------- > if len(sys .argv) < 2: > show_help() > exit() > > script = sys.argv [1] > if len (script) > 3 and script[- 3:].lower() != '.py': > script += '.py' > params = "" > for arg in sys.argv [2:]: > params += " \"" + arg + "\"" > path_str = os.environ ['PATH'] > paths = path_str.split (';') > for path in paths : > if len( path) == 0: > continue > if path[- 1] != '\\' : > path += '\\' > > full_path = path + script > if os. path.isfile(full_path) : > cmd = "python \" " + full_path + " \"" + params > os .system(cmd) > exit() > > -- > http://www.2maomao.com/blog > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > -- 茫茫人海,你是我的最爱 -------------- 下一部分 -------------- 一个HTML附件被移除... URL: http://python.cn/pipermail/python-chinese/attachments/20080122/fb78efa0/attachment.htm
2008年01月22日 星期二 10:36
ÔÀ´Èç´Ë¼òµ¥ :D http://xlp223.yculblog.com/post.1415372.html ´óÐܽÅÓ¡¶à°¡¡£ ÔÚ08-1-22£¬´óÐÜ <bearsprite在gmail.com> дµÀ£º > > Ö»ÒªÐÞ¸ÄÁ½¸ö»·¾³±äÁ¿¾ÍÐÐÁË > 1. PATH£¬°ÑC:\python25\scripts¼ÓÉÏ£¨¼ÙÉèÄãµÄpython2.5°²×°ÔÚcÅÌ£© > 2.PATHEXT£¬Ìí¼ÓÀ©Õ¹Ãû.PY;.PYW > > È»ºóÄã¾Í¿ÉËæ±ãÖ´ÐÐÄãµÄpython½Å±¾ÁË£¬¾ÍÏñEXE»òBATÒ»Ñù > > ÔÚ08-1-22£¬realfun < realfun在gmail.com> дµÀ£º > > > > ºÇºÇ£¬Ã«Ëì×Ô¼öÒ»¸öС¹¤¾ß¡£ > > > > Python¾³£»á°Ñ½Å±¾×°ÔÚ%Python%\ScriptsÏÂÃ棬ºÜÄÑÓã¬Ö´ÐеÄʱºòÐèÒªÅܵ½Õâ¸öĿ¼ÏÂÈ¥¸ã > > > > Èç¹û£¬½Å±¾Ïñ¿ÉÖ´ÐгÌÐòÄÇÑù£¬*ÔÚϵͳµÄPATHÀïËæ±ãÕÒ¸öĿ¼һ·Å¾ÍÄܵ½´¦Ö´ÐÐ*¸Ã¶àºÃ£¡ > > > > Ô糿ÅÀÆðÀ´£¬Ð´Á˸ö¹¤¾ß£¬°üÀ¨Ò»¸öÅú´¦ÀíÎļþÒÔ¼°Ò»¸öpython½Å±¾¡£ > > *°²×°·½·¨*£º > > 1. ÏÂÔØhttp://www.2maomao.com/blog/wp-content/uploads/exepy.zip > > 2. ÔÚϵͳPATHÖÐÕÒ¸öĿ¼£¬ÍùÀïÒ»ÈÓ¾ÍÐУ¬ÎÒ·ÅÔÚÁËc:\python\scripts£¨ÒѾ¼ÓÈëϵͳPATHÖУ© > > > > *ʹÓ÷½·¨*£º > > ´Ë¹¤¾ßΪÃüÁîÐй¤¾ß > > ÔÚÃüÁîÐÐÖУ¬ÇÃÈ룺p epydoc xxx > > ÕâÑù¾Í¿ÉÒÔÖ´ÐÐc:\python\scripts\ÏÂÃæµÄepydoc.pyÁË£¬xxxÊDzÎÊýÁбí > > > > *×¢Òâ*£ºpython.exeËùÔÚĿ¼Ҫ¼ÓÈëµ½PATHÖУ¬Í¨³£ÊÇc:\python > > > > ¡ª¡ª¡ª¡ª-*ʵÏÖϸ½Ú*¡ª¡ª¡ª¡ª- > > Åú´¦ÀíÎļþp.bat£º > > ÏÂÔØ: p.bat<http://www.2maomao.com/blog/wp-content/plugins/coolcode/coolcode.php?p=451&download;=p.bat> > > @echo off > > REM this command file intend to quickly execute python file in the PATH > > REM Usage: p xxx, xxx is the name of xxx.py in PATH > > python %~dp0\py\exepy.py %1 %2 %4 %5 %6 %7 %8 %9 > > @echo on > > > > Python½Å±¾£¨·ÅÔÚp.batËùÔÚµÄĿ¼µÄ"py"×ÓĿ¼Ï£¬¿ÉÒÔ×Ô¼ºÈ¥ÐÞ¸Äp.batÀ´×Ô¶¨ÒåĿ¼£© > > #!/usr/bin/python > > import os > > import sys > > #----------------------------------------------- > > def show_help(): > > print > > print " Purpose: Execute python script in system PATH" > > print " Usage: p python_script_name [params] " > > print > > #----------------------------------------------- > > if len(sys .argv) < 2: > > show_help() > > exit() > > > > script = sys.argv [1] > > if len (script) > 3 and script[- 3:].lower() != '.py': > > script += '.py' > > params = "" > > for arg in sys.argv [2:]: > > params += " \"" + arg + "\"" > > path_str = os.environ ['PATH'] > > paths = path_str.split (';') > > for path in paths : > > if len( path) == 0: > > continue > > if path[- 1] != '\\' : > > path += '\\' > > > > full_path = path + script > > if os. path.isfile(full_path) : > > cmd = "python \" " + full_path + " \"" + params > > os .system(cmd) > > exit() > > > > -- > > http://www.2maomao.com/blog > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to > > python-chinese-request在lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > -- > ããÈ˺££¬ÄãÊÇÎÒµÄ×î°® > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > -- http://www.2maomao.com/blog -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20080122/e38e9f38/attachment.html
2008年01月23日 星期三 22:40
这段代码的上色是什么做到的? gmail似乎不直接提供这个功能呐
2008年01月24日 星期四 09:58
ÔÚÓиßÁÁµÄ±à¼Æ÷Àï±à¼ºÃ ¸´ÖÆ Õ³Ìù 2008/1/23 ±ÌÀ¶ÓÒ¶ú <1001night在gmail.com>: > Õâ¶Î´úÂëµÄÉÏÉ«ÊÇʲô×öµ½µÄ£¿ > gmailËƺõ²»Ö±½ÓÌṩÕâ¸ö¹¦ÄÜÄÅ > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20080124/2f18c3d2/attachment.htm
Zeuux © 2024
京ICP备05028076号