浙江省高等学校教师教育理论培训

微信搜索“毛凌志岗前心得”小程序

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
上一页 1 ··· 575 576 577 578 579 580 581 582 583 ··· 630 下一页

2010年9月20日

摘要: >>> code="""a=1... print a""">>> code'a=1\nprint a'>>> compile(code,'<string>','exec')<code object <module> at 0xb77065c0, file "<string>", line 1>&g... 阅读全文
posted @ 2010-09-20 08:02 lexus 阅读(155) 评论(0) 推荐(0)

摘要: PythonPackage Index : KirbyBase 1.9- 阅读全文
posted @ 2010-09-20 06:50 lexus 阅读(229) 评论(0) 推荐(0)

2010年9月19日

摘要: python自2.6开始提供了多进程模块multiprocessing,这里主要是介绍multiprocessing下的Pool的几个函数一 apply(func[, args[, kwds]]) apply用于传递不定参数,同python中的apply函数一致(不过内置的apply函数从2.3以后就不建议使用了),主进程会阻塞于函数。 for x in gen_list(l): result =... 阅读全文
posted @ 2010-09-19 23:44 lexus 阅读(261) 评论(0) 推荐(0)

摘要: Recipe 511474: Run function in separate process (Python) by Muhammad AlkarouriActiveState Code (http://code.activestate.com/recipes/511474/)http://code.activestate.com/recipes/511474-run-function-in-s... 阅读全文
posted @ 2010-09-19 23:09 lexus 阅读(216) 评论(0) 推荐(0)

摘要: python 切换进程为用户态 - [Python]版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明http://25swf.blogbus.com/logs/56309597.html在python新启的进程中调用以下代码,tinsgao 为用户名from os import setuidsetuid(int(os.popen("id -u %s"%"tinsgao").read... 阅读全文
posted @ 2010-09-19 22:58 lexus 阅读(144) 评论(0) 推荐(0)

摘要: 一个比较容易想到的办法是使用CPython进程代替线程作为CPU调度的单位,进程间通过管道、消息等机制进行通信。在系统级别上,产生一个进程当然比产生一个线程吃力得多,必须维护独立的地址空间和其中包含的所有资源,通信开销也比较高,但确实可以充分利用所有CPU核心的计算能力。多进程架构的天然优势是稳定性,单点失败不容易影响其它工作的正常执行。Python 2.4之前可以通过os.spawn、os.po... 阅读全文
posted @ 2010-09-19 22:38 lexus 阅读(186) 评论(0) 推荐(0)

摘要: http://www.developertutorials.com/tutorials/python/python-persistence-management-050405-1306/ 阅读全文
posted @ 2010-09-19 21:16 lexus 阅读(138) 评论(0) 推荐(0)

摘要: dotnet下的remoting,java下的rmiPyro - Python Remote Object 看到這個有趣的東西:pyro (Python Remote Object), 也就是Python版的Java RMI(Remote Method Invocation)。簡單來說,就是隱藏了網路等底層的實作,讓programmer能很快的做出分散式計算的應用程式(through RPC)... 阅读全文
posted @ 2010-09-19 20:50 lexus 阅读(201) 评论(0) 推荐(0)

摘要: #!/usr/bin/env python#encoding=utf-8from subprocess import Popen, PIPE, STDOUTcmd = '/home/mlzboy/my/ide/test/time_sleep.py'p = Popen(cmd, shell=False, stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fd... 阅读全文
posted @ 2010-09-19 20:41 lexus 阅读(183) 评论(0) 推荐(0)

摘要: 我看好你爱称臣服务工具有节目前沿革职场坝堤岸壁报道白挨边隘害眼花式子孙子孙子子孙孙孙子子孙子孙子孙子孙孙子孙子子孙子孙子孙子子孙子孙孙子孙子孙子孙子孙子孙子孙子孙子孙子孙孙子孙子子子孙孙子孙子孙子孙子孙子孙子孙子子孙孙子孙子孙子孙子孙子孙子孙子孙子子孙孙子孙子孙子孙子孙子孙子孙子孙孙子子子孙孙子孙子孙子孙子孙子孙孙子孙子子孙子子孙孙子孙子孙子孙孙子子孙孙子子孙子孙子孙孙子子孙孙子孙子子子孙孙子孙孙... 阅读全文
posted @ 2010-09-19 20:02 lexus 阅读(180) 评论(0) 推荐(0)

摘要: 呵呵 阅读全文
posted @ 2010-09-19 19:46 lexus 阅读(155) 评论(0) 推荐(0)

摘要: 据我说知 阅读全文
posted @ 2010-09-19 19:42 lexus 阅读(168) 评论(0) 推荐(0)

摘要: 只在同一进程内,执行额外的python脚本 阅读全文
posted @ 2010-09-19 18:09 lexus 阅读(277) 评论(0) 推荐(0)

摘要: reference:http://luy.li/2010/08/29/pythonunbuffered/#comment-11451考虑以下python程序:其中的sys.stdout.write也可以换成print。 运行这程序,你觉得会输出什么?试验一下,就会发现,其实输出并不是而是:究其原因,是因为缓存:虽然stderr和stdout默认都是指向屏幕的,但是stderr是无缓存的,程序往st... 阅读全文
posted @ 2010-09-19 18:08 lexus 阅读(556) 评论(0) 推荐(0)

摘要: #!/usr/bin/env pythonimport os def my_fork(): child_pid = os.fork() if child_pid == 0: print "Child Process: PID# %s" % os.getpid() else: print "Parent Process: PID# %s" % os.getpid() if __name__ =... 阅读全文
posted @ 2010-09-19 07:03 lexus 阅读(184) 评论(0) 推荐(0)

摘要: http://www.python.org/workshops/2002-02/papers/11/index.htmPython - Web Load Tester - Multiple Processes and ThreadsMultiple processes (forking) in Pythonhttp://www.wellho.net/mouth/2694_Multiple-proc... 阅读全文
posted @ 2010-09-19 06:35 lexus 阅读(172) 评论(0) 推荐(0)

2010年9月18日

摘要: ubuntu提速http://blog.163.com/hejun520@126/blog/static/2365172520082300941473/ 阅读全文
posted @ 2010-09-18 23:21 lexus 阅读(233) 评论(0) 推荐(0)

摘要: http://www.opensoce.com/?p=908LynxLynxis a text browser for the World Wide Web.Lynx 2.8.7runs on Un*x, VMS, Windows 95/98/NT, DOS386+ butnot3.1, 3.11, or OS/2 EMX.Thecurrent developmental versionis al... 阅读全文
posted @ 2010-09-18 22:41 lexus 阅读(386) 评论(0) 推荐(0)

摘要: ubuntu速度慢的原因之内存和swap分区浏览: 75 评论: 0 发表评论 作者: 聖騎天下我在日常使用ubuntu时,经常要同时打开10几个窗口和应用,有时候就会发生速度变得很慢的情况,甚至系统明显反应迟钝,这时一般是物理内存不够用,系统开始用换硬盘上的swap分区做虚拟内存,其速度可想而知。在ubuntu里面往往不是物理内存全部耗尽采取使用swap分区,swappiness的值的大小对如何... 阅读全文
posted @ 2010-09-18 22:36 lexus 阅读(364) 评论(0) 推荐(0)

摘要: Python中静态方法的实现Python似乎很讨厌修饰符,没有常见的static语法。其静态方法的实现大致有以下两种方法:第一种方式(staticmethod):>>> class Foo: str = "I'm a static method." def bar(): print Foo.str bar = staticmethod(bar)>>> Foo.... 阅读全文
posted @ 2010-09-18 13:18 lexus 阅读(1235) 评论(0) 推荐(1)

上一页 1 ··· 575 576 577 578 579 580 581 582 583 ··· 630 下一页